Development Environment |
You can comment the current line or a selection of lines. To select a line, click just to the left of the line. The line becomes highlighted. Drag or Shift+click to select multiple lines. Then select Comment from the Text menu, or right-click and select it from the context menu. A comment symbol, %
, is added at the start of the line, and the color of the text becomes green (or the color specified for comments in Editor/Debugger preferences).
You can make any line a comment by typing a %
at the beginning of it. To put a comment within a line, type %
followed by the comment text; MATLAB treats all the information after the %
on that line as a comment.
You can also uncomment a selected group of lines--select Uncomment from the Text menu, or right-click and select it from the context menu.
Formatting Comments. To make comment lines in M-files wrap when they reach a certain column:
If you want comment lines to automatically be limited to the maximum width while you type, select the Editor preference to Autowrap comments--see M-file comment formatting.
Appearance of an M-File | Showing Balanced Delimiters |