Desktop Tools and Development Environment |
M Language Preferences
Select File -> Preferences -> Editor/Debugger -> Language -> M to specify these preferences for editing M-files:
Syntax Highlighting
Select the Enable syntax highlighting check box to show colors that help you identify certain constructs like matching if/else
statements. Click Set Colors, and the Colors preference dialog box opens, where you specify the colors used for syntax highlighting.
Syntax highlighting for M-files applies to files with the m
and cdr
extensions. The extension can be uppercase or lowercase. Because syntax highlighting is used in the Command Window, Command History, and other tools, as well as in the Editor/Debugger, the Colors preferences apply to all tools. For a description of syntax highlighting, see Syntax Highlighting in the Command Window documentation.
Select the style of indenting you want the Editor/Debugger to use for M-files. The style applies when you press the Enter key to type in a new line. Examples follow, illustrating the different styles, which are:
The indenting style only applies to lines you enter after changing the preference; it does not affect the indenting of existing lines. To change the indenting for existing lines, use the Text menu entries for indenting. See Indenting.
For any indenting style, you can manually insert tabs at the start of a line. The tab size is specified in Keyboard and Indenting preferences for the Editor/Debugger--see Tabs and Indents. When indents automatically apply to a line but you do not want them on that line, use backspace (or delete selection) to move the cursor to the left. If you select Smart indent and manually insert tabs, automatic smart indenting may not work properly; use the Text menu entry for Smart Indent to correct selected lines.
Example of No Indent Without Tabs.
Example of No Indent with Tabs.
Function Indenting Format
If you select the Smart indent format for the Indenting for Enter Key preference, you can specify automatic indenting for function statements. For nested functions, you must use an end
statement for each function
statement in the file. The styles for indenting functions are
function
line, that line automatically indents, as do subsequent lines, until the next end
statement.
function
within a function
) line. Statements within the nested function are indented further. An end
statement aligns with its matching function if end
appears at the start of the line.
end
statement aligns with its matching function if end
appears at the start of the line.
Examples of Function Indenting Format Preference.
Specify the Max width, that is, the maximum width, in number of columns, for M-file comments when you select the Autowrap comments preference. The maximum width also applies when you use the Wrap Selected Comments feature. See Formatting Comments for details.
For example, assume you select Autowrap comments and set the maximum width to be 75 characters, which is the width that will fit on a printed page using the default font for the Editor/Debugger. When typing a comment line, as you reach the 75th column, the comment automatically continues on the next line.
See also the Right-Hand Text Limit preference for the Editor/Debugger.
See Also
Language Preferences for the Editor/Debugger | C/C++ Language Preferences |
© 1994-2005 The MathWorks, Inc.