Desktop Tools and Development Environment |
Running M-Files from the Editor/Debugger
You can run a script or a function that does not require an input argument directly from the Editor/Debugger. Click the Run button on the toolbar, or select Run from the Debug menu.
If the file is not in a directory on the search path or in the current directory, a dialog box appears, presenting you with options that allow you to run the file. You can either change the current directory to the directory containing the file, or you can add the directory containing the file to the search path.
If the file has unsaved changes, running it from the Editor/Debugger automatically saves the changes before running. In that event, the menu item is Save and Run.
See Running an M-File with Breakpoints for additional information about running M-files while debugging. While debugging, you can execute sections of an M-file even though there are unsaved changes--see Running Sections in M-Files That Have Unsaved Changes.
Viewing Datatips
For a script M-file, position the cursor to the left of a variable on that line. Its current value appears--this is called a datatip, which is like a tooltip for data. The datatip stays in view until you move the cursor. If you have trouble getting the datatip to appear, click in the line and then move the cursor next to the variable.
In edit mode, the datatips display the values of variables in the base workspace, so this is useful for script M-files rather than function M-files. In a function M-file, if you hover over a variable that also exists in the base workspace, the datatip displays the value of the base workspace variable, not the value of the variable in the function M-file. To avoid confusion, by default, datatips are off for edit mode. To change that, select File -> Preferences -> Display, and for General Display Options, set the check mark for Enable datatips in edit mode.
While you are debugging, you cannot turn off the display of datatips, and they show the value of the variables in the workspace selected in the Stack.
A related function is datatipinfo
. See the datatipinfo
reference page for more information.
Saving M-Files | Printing M-Files |
© 1994-2005 The MathWorks, Inc.