The MATLAB editor automatically highlights all content after %%
comments, and text after %%
in the same line are turned bold. But what\'s the essential
I really like the double percent sign (%%
) and use as far as possible for the following reasons:
Creates a cell block which could be run separately from the whole code (Ctrl + Enter).
As mentioned in sections, it improves the readability of the file and appears as a heading if you publish your code. It increases concentration by creating a yellow background and you can focus more on the part that you are working on.
You can fold the code in cell blocks. (First you should enable code folding of cell blocks in Preferences >> Editor/Debugger >> Code Folding >> Sections). This is useful specially in large mfiles.
If you care about keeping a clean Command History running the codes in cell blocks (Ctrl + Enter) does not leave any trace in Command History , unlike the Evaluate Selection (F9) which evaluates the selected (highlighted) code and holds the executed code in Command History.
Hope it helps.