True if a string mxArray
C Syntax
#include "matrix.h"
bool mxIsChar(const mxArray *array_ptr);
Arguments
array_ptr
Pointer to an mxArray
.
Returns
true
if array_ptr
points to an array having the class mxCHAR_CLASS
; otherwise, returns false
.
Description
Use mxIsChar
to determine if array_ptr
points to string mxArray
.
Calling mxIsChar
is equivalent to calling
mxGetClassID(array_ptr) == mxCHAR_CLASS
Example
Consider a MEX-file that expects its first input argument to be a string mxArray
. If it is not a string mxArray
, the MEX-file issues an error message.
void
mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray
*prhs[])
{
if (mxIsChar(prhs[0])) {
/* ... Yes, it is a string mxArray. */
}
else /* No, this is not a string array. */
mexErrMsgTxt("You must specify a string array");
}
For an additional example, see mxischar.c
in the mx
subdirectory of the examples
directory.
See Also
mxIsClass
, mxGetClassID
[ Previous | Help Desk | Next ]