True if a sparse mxArray
C Syntax
#include "matrix.h"
bool mxIsSparse(const mxArray *array_ptr);
Arguments
array_ptr
Pointer to an mxArray.
Returns
1 if array_ptr points to a sparse mxArray; otherwise, returns 0. A return value of 0 means that array_ptr points to a full mxArray or that array_ptr does not point to a legal mxArray.
Description
Use mxIsSparse to determine if array_ptr points to a sparse mxArray. Many routines (for example, mxGetIr and mxGetJc) require a sparse mxArray as input.
Examples
Consider a MEX-file that requires the first input argument to be a sparse mxArray. The first part of the MEX-file might be
void
mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray
*prhs[])
{
if (mxIsSparse(prhs[0])) {
/* Yes, this is a sparse mxArray. */
...
}
else
mexErrMsgTxt("First argument must be a sparse array.");
For an additional example, see mxissparse.c in the mx subdirectory of the examples directory.
See Also
mxGetIr, mxGetJc, mxIsFull
[ Previous | Help Desk | Next ]