Programming Previous page   Next Page

Organizing Data in Multidimensional Arrays

You can use multidimensional arrays to represent data in two ways:

For example, consider an RGB image. For a single image, a multidimensional array is probably the easiest way to store and access data.

To access an entire plane of the image, use

To access a subimage, use

The RGB image is a good example of data that needs to be accessed in planes for operations like display or filtering. In other instances, however, the data itself might be multidimensional. For example, consider a set of temperature measurements taken at equally spaced points in a room. Here the location of each value is an integral part of the data set--the physical placement in three-space of each element is an aspect of the information. Such data also lends itself to representation as a multidimensional array.

Now to find the average of all the measurements, use

To obtain a vector of the "middle" values (element (2,2)) in the room on each page, use


Previous page  Computing with Multidimensional Arrays Multidimensional Cell Arrays Next page

© 1994-2005 The MathWorks, Inc.