Special Characters

There are a number of special reserved characters used in MATLAB for various purposes. Some of these are used as arithmetic operators, namely, +, -, *, / and \. While others perform a multitude of purposes:

% -- anything after % (and until end of line) is treated as comments, e.g.,
>> x = 1:2:9; % x = [1 3 5 7 9];
! -- prepend it to a unix command to execute, e.g.,
>> !ls -l
; -- delimits statements; suppresses screen output, e.g.,
>> x = 1:2:9; y = 2:10; % two statements on the same line
... -- statement continuation, e.g.,
>> x = [ 1 3 5 ...
7 9]; % x = [1 3 5 7 9] splitted into 2 lines
: -- range delimiter, e.g.,
>> x = [1:2:9]; % x=[1,3,5,7,9]
' -- matrix transposition, e.g.,
>> x = [1:2:9]'; % x changed from row vector to column vector
If the vector/matrix is complex, "'" results in complex conjugation and matrix transposition.
, -- command delimiter, e.g.,
>> x = [1:2:9], y = [1:9] % two statements on the same line
. -- precede an arithmetic operator to perform an elemental operation, instead of matrix operation, e.g.,
>> x = 3:3:9

x =

     3     6     9

>> y = 3*ones(3,1)'

y =

     3     3     3

>> z =x./y

z =

     1     2     3
* -- "wild card", e.g.,
>> clear A* % clears all variables that start with A.

Note that many of these characters have multiple functionalities (function overloading) depending on the context, e.g., "*" is used for scalar multiply, matrix multiply and "wild card" as seen above.