External Interfaces/API    

Handling Sparse Arrays

The MATLAB API provides a set of functions that allow you to create and manipulate sparse arrays from within your MEX-files. These API routines access and manipulate ir and jc, two of the parameters associated with sparse arrays. For more information on how MATLAB stores sparse arrays, refer to the section, The MATLAB Array.

This example illustrates how to populate a sparse matrix.

At the MATLAB prompt, entering

creates a full, 5-by-5 identity matrix. Using fulltosparse on the full matrix produces the corresponding sparse matrix.

  Manipulating Multidimensional Numerical Arrays Calling Functions from C MEX-Files