Comments Spanning Multiple Lines
Commenting part of a statement spanning multiple lines uses ellipsis (…).
Example :
MATLAB
%{ a = [1 2 3] b = 5 %} x = [ 'Matlab is a ' ... 'programming language' ... ... 'invented by Cleve Moler' ... ', it is user friendly' ] |
Output :
Matlab is a programming language, it is user friendly
To comment out the lines of code in a script, press Ctrl + R, to uncomment them press Ctrl + T.
Comments in MATLAB
Comments are generic English sentences, mostly written in a program to explain what it does or what a piece of code is supposed to do. More specifically, information that programmer should be concerned with and it has nothing to do with the logic of the code. They are completely ignored by the compiler and are thus never reflected on to the input.
In MATLAB, comments are of two types:
- Single-line Comments
- Block Comments
- Spanning MUltiple Lines