Desktop Tools and Development Environment Previous page   Next Page

Appearance of an M-File

The following features make M-files more readable:

You can specify the default behaviors for some of these--see Fonts, Colors, and Other Preferences.

Syntax Highlighting

Some entries appear in different colors to help you better find matching elements, such as if/else statements. This is called syntax highlighting and is used in the Command Window and History, as well as in the Editor/Debugger. For more information, see the Command Window documentation for Syntax Highlighting

When you paste or drag a selection from the Editor/Debugger into another application, such as Microsoft Word, the Editor/Debugger maintains the syntax highlighting colors and font characteristics from the file in the other application. MATLAB pastes the selection to the clipboard in RTF format, which many Windows and Macintosh applications support.

You can set preferences that cause MATLAB to notify you about matched and unmatched delimiters. For example, when you type a parenthesis or another delimiter, MATLAB highlights the matched parenthesis or delimiter in the pair. For details, see Parentheses Matching Preferences for the Editor/Debugger.

Indenting

Program control entries are automatically indented make reading loops, such as while/end statements, easier.

To move the current or selected lines further to the left, select Decrease Indent from the Text menu. To move the current or selected lines further to the right, select Increase Indent from the Text menu. If after using these features you want to apply automatic indenting to selected lines, select Smart Indent from the Text menu, or right-click and select it from the context menu.

Select a line or group or lines and press the Tab key to indent the lines. Press Shift+Tab to decrease the indent for the selected lines. This works differently if you select the preference for Emacs style Tab key smart indenting--when you position the cursor in any line or select a group of lines and press Tab, the lines indent according to smart indenting practices.

For more information about smart indenting and indenting preferences, see the Keyboard and Indenting Preferences for the Editor/Debugger and Language Preferences for the Editor/Debugger in the online documentation.

Nested Functions Indenting

If you select the language preference for smart indenting, you can select from three indenting options when you enter a nested function (a function within a function) in the Editor/Debugger. For details, see Function Indenting Format in the online documentation for Editor/Debugger preferences.

Line and Column Numbers

Line numbers are displayed along the left side of the Editor/Debugger window. You can elect not to show the line numbers using preferences--for details, see Display Preferences for the Editor/Debugger in the online documentation.

The line and column numbers for the current cursor position are shown in the far right side of the status bar in the Editor/Debugger.

Right-Hand Text Limit

By default, a light red vertical line appears at column 75 in the Editor/Debugger, providing a cue as to when a line becomes wider than desired, which is useful to know for printing, for example. You can hide the line or change the column number at which it appears--see Display Preferences for the Editor/Debugger in the online documentation.

View Function or Subfunction

To see the function or subfunction the cursor is currently at, look at the right side of the status bar in the Editor/Debugger.


Previous page  Changing the Case of Selected Text Keyboard and Mouse Shortcuts in the Editor/Debugger Next page

© 1994-2005 The MathWorks, Inc.