There are special parameters associated with sparse matrices, namely ir , jc , and nzmax . This example illustrates how to populate a sparse matrix. C Example for illustrating how to populate a sparse matrix. The gateway routine.
C Get the size and pointers to input data.
C Allocate space. The maximum number of non-zero elements cannot be less C than the number of columns in the matrix. C Load the sparse data. This is the subroutine that fulltosparse calls to fill the mxArray with the sparse data. This is the subfunction called by fulltosparse that fills the C mxArray with the sparse data.