External Interfaces Previous page   Next Page

Manipulating Multidimensional Numerical Arrays

You can manipulate multidimensional numerical arrays by using mxGetData and mxGetImagData to return pointers to the real and imaginary parts of the data stored in the original multidimensional array. This example takes an N-dimensional array of doubles and returns the indices for the nonzero elements in the array.

Entering a sample matrix at the MATLAB prompt gives

This example determines the position of all nonzero elements in the matrix. Running the MEX-file on this matrix produces

Previous page  Handling 8-,16-, and 32-Bit Data Handling Sparse Arrays Next page

© 1994-2005 The MathWorks, Inc.