| MATLAB Application Program Interface | Search  Help Desk |
| mxCreateCharMatrixFromStrings | Examples See Also |
Create a populated two-dimensional string mxArray
C Syntax
#include "matrix.h" mxArray *mxCreateCharMatrixFromStrings(int m, const char **str);
Arguments
mmxArray. The value you specify for m should equal the number of strings in str.
str
str array must contain at least m strings.
Returns
A pointer to the created stringmxArray, if successful. If unsuccessful in a stand-alone (nonMEX-file) application, mxCreateCharMatrixFromStrings returns NULL. If unsuccessful in a MEX-file, the MEX-file terminates and control returns to the MATLAB prompt. Insufficient free heap space is the primary reason for mxCreateCharArray to be unsuccessful. Another possible reason for failure is that str contains fewer than m strings.
Description
UsemxCreateCharMatrixFromStrings to create a two-dimensional string mxArray, where each row is initialized to a string from str. The created mxArray has dimensions m-by-max, where max is the length of the longest string in str.
Note that string mxArrays represent their data elements as mxChar rather than as char.
Example
Seemxcreatecharmatrixfromstr.c in the mx subdirectory of the examples directory.
See Also
mxCreateCharArray, mxCreateString, mxGetString