Cf. Example 4. The $-operator is often a more elegant notation for for-loops. _for, _for_down and _for_in ...
www.mathworks.in