chapter  5
12 Pages

MATLAB Functions

You can delete rows or columns of a matrix by assigning the empty matrix ([]) to them. Try:

A(:, [2 4]) = []

In an array index expression, end denotes the index of the last element. Try:

x = rand(1,5)

x = x(end:-1:1)

MATLAB is a powerful and expressive language. To appreciate the usefulness of these features, compare these MATLAB statements with the equivalent code in C, Fortran, or Java.