Multi-dimensional matrix

A numerical matrix can also be multi-dimensional, whose each element is referenced by three or more indices. To create such a matrix, one has to use any of the three built-in functions zeros, ones, or rand, with three or more parameters to specify the size of each dimension. For example, the following command returns a matrix of 5 slices, with each slice having 3 rows and 2 columns.
>> rand(5,3,2);
An element or a slice of a multi-dimensional matrix can be referenced or reset using an indexing expression with appropriate number of indices. For example
>> x = rand(5,3,2);
>> x[1, :, :]; // the first slice of x

Note that the only storage type available for multi-dimensional matrices is double precision floating point number. Therefore type does not need no be specified.

If two multi-dimensional matrices A and B have the same dimensions, A + B and A - B are defined the usual way. The only other operation defined for multi-dimensional matrix is scalar multiplication.



oz 2009-12-22