Desktop Tools and Development Environment Previous page   Next Page

Navigating in an M-File

There are several options for navigating in M-files:

See also Finding Text in Files.

Going to a Line Number

Select Edit -> Go To. In the resulting Go To dialog box, select the Line number option, enter a line number, and click OK. The cursor moves to that line number in the current M-file.

Going to a Function (Subfunctions and Nested Functions)

To go to a function within an M-file (either a subfunction or a nested function), select Edit -> Go To. In the resulting Go To dialog box, select the Function option, and then select an entry from the list of subfunctions and nested functions in the file. Click OK.

Image of Go To dialog box.

Functions in the list appear alphabetically by name. To order them by their position in the file, click the Line column heading. The list does not include functions that are called from the M-file, but only shows lines in the current M-file that begin with a function statement.

Alternatively, click the Show Functions button on the toolbar. Then select the subfunction or nested function you want to go to from the list. The functions are listed in order of position in the file.

Note that the subfunction or nested function the current line is part of is shown in the status bar.

Going to a Cell.   For M-file scripts that contain cells for rapid code iteration or publishing, the Go To dialog box lists cell titles.

Going to a Bookmark

You can set a bookmark at a line in a file in the Editor/Debugger so you can quickly go to the bookmarked line. This is particularly useful in long files. For example, while working on a line, if you need to look at another part of the file and then return, set a bookmark at the current line, go to the other part of the file, and then go back to the bookmark.

To set a bookmark, position the cursor anywhere in the line and select Edit ->Set Bookmark. A bookmark icon appears to the left of the line.

Image of line with bookmark.

To go to a bookmark, select Next Bookmark or Previous Bookmark from the Edit menu.

To clear a bookmark, position the cursor anywhere in the line and select Edit -> Clear Bookmark.

Bookmarks are not maintained after you close a file.


Previous page  Keyboard and Mouse Shortcuts in the Editor/Debugger Finding Text in Files Next page

© 1994-2005 The MathWorks, Inc.