Controlling the MATLAB Path from the Editor
Quiz: When setting a breakpoint in a file open in the Editor, your primary motivation is
- To stop at the corresponding line of code in the debugger.
- To change the MATLAB current folder.
- To add the file’s parent folder to the search path.
- To decorate your file with red ornaments for the holidays.
If you answered B or C to the question above, there is a new feature in R2010b that you will like (if you answered D, it’s time to leave your computer and go Christmas tree shopping)!
In R2010b, if you right-click on the document tab of a file open in the Editor, there are options to change the Current Folder to the file’s parent directory, add/remove the parent directory from the search path, or copy the file’s full path to the clipboard. In addition, on Windows and Macintosh platforms there is an option to locate the file in the system file explorer.
Currently the document tabs are only available when you have multiple files open in the Editor. So I will end this post with one more quiz.
Quiz: If you have only one file open in the Editor, how do you access the new path actions?
- Through brilliant keyboard shortcuts you configured using the Keyboard Shortcuts preference panel.
- By clicking the “New” toolbar item and then right-clicking on the document tab for the file originally open in the Editor.
- By requesting them in your annual letter to St. Nick.
If you answered B, you get full credit. If you answered A, you get partial credit. Change Current Folder, Locate on Disk, and Copy Full Path to Clipboard are available in the Keyboard Shortcuts preference panel and can be assigned shortcuts (though they do not have them by default). However, the Add/Remove from Path action cannot be assigned a shortcut because it has several variations in the Current Folder depending on whether or not subfolders are included.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.