[MATLAB logo] Exploiting MATLAB's Data Structures

N-D Arrays

Use N-D arrays for multidimensional datasets or for collections of arrays that are conformable. N-D arrays are commonly used in vectorized solutions since many of MATLAB's functions can operate either element-by-element or along a specified dimension of an N-D array.

Syntax:

a(i,j,k) % Use more subscripts -- one per dimension
a(:,i,:) = 5; % scalar expansion

Examples:

RGB images (m x n x 3)
spatial data (temperature in a room)
sequences of commensurate matrices (frequency response of MIMO system)

Problem #3 - MRI of healthy human man

More info ...

Specialized N-D functions

 ndims  Number of dimensions
 size  Size of each dimension
 permute  Permute (transpose) array
 cat  Concatenate arrays
 squeeze  Remove singleton dimensions
 reshape  Change size

Examples of functions that operate element-by-element on N-D arrays

sin, cos, abs, floor, mod, besselj, erf, +, .*, ./, .\, .^

Examples of functions that operate along a specified dimension

sum, prod, diff, fft

Examples of functions that don't work on arrays bigger than 2-D

*, \, /, eig, plot, chol

 

See also chapter 12 in Using MATLAB.

Copyright © 1997 The MathWorks, Inc.
clay@mathworks.com
$Revision$ $Date$