| External Interfaces/API Reference | ![]() |
Create a two-dimensional unpopulated sparse mxArray
Fortran Syntax
Arguments
n
The desired number of columns.
nzmax
The number of elements that mxCreateSparse should allocate to hold the pr, ir, and, if ComplexFlag = 1, pi arrays. Set the value of nzmax to be greater than or equal to the number of nonzero elements you plan to put into the mxArray, but make sure that nzmax is less than or equal to m*n.
ComplexFlag
Specify REAL = 0 if the data has no imaginary components; specify COMPLEX = 1 if the data has some imaginary components.
Returns
An unpopulated, sparse mxArray if successful, and 0 otherwise.
Description
Call mxCreateSparse to create an unpopulated sparse mxArray. The returned sparse mxArray contains no sparse information and cannot be passed as an argument to any MATLAB sparse functions. In order to make the returned sparse mxArray useful, you must initialize the pr, ir, jc, and (if it exists) pi array.
mxCreateSparse allocates space for
pr array of length nzmax.
pi array of length nzmax (but only if ComplexFlag is COMPLEX = 1).
ir array of length nzmax.
jc array of length n+1.
When you finish using the sparse mxArray, call mxDestroyArray to reclaim all its heap space.
See Also
mxDestroyArray, mxSetNzmax, mxSetPr, mxSetIr, mxSetJc
| mxCreateScalarDouble | mxCreateString | ![]() |