I want to do this in an easy way.
Starting in MATLAB 7 (R14), the syntax is:
%{
Stuff to be commented out
%}
You can also highlight a section of code and type control-r to comment out the code -- this will place a percent symbol (%) at the beginning of the line. Typing control-t will uncomment the lines by removing any percent symbol that is the first non-blank character on the line.
If you have an older version, the built-in editor in MATLAB 6.0 has a block-comment feature, which will simply put a comment character on each line. Or you can use matlab-mode for Emacs, which supports this as well.
If you are using an even older version, use this:
if 0 commented out code end
This is not the best solution, since parse errors inside that block will cause an error.
[From the MATLAB FAQ of Ancient Times]
Also, the control-r and control-t work for C source code as well ... putting and removing the // style comments.
0 Comments