| MATLAB Application Program Interface | Search  Help Desk |
| mxCreateString | Examples See Also |
Create a 1-by-n string mxArray initialized to the specified string
C Syntax
#include "matrix.h" mxArray *mxCreateString(const char *str);
Arguments
strmxArray's initial data.
Returns
A pointer to the created stringmxArray, if successful; otherwise, returns NULL. The most likely cause of failure is insufficient free heap space.
Description
UsemxCreateString to create a string mxArray initialized to str. Many MATLAB functions (for example, strcmp and upper) require string array inputs.
Free the string mxArray when you are finished using it. To free a string mxArray, call mxDestroyArray.
Examples
Seerevord.c in the refbook subdirectory of the examples directory.
For additional examples, see mxcreatestructarray.c, mxisclass.c, and mxsetallocfcns.c in the mx subdirectory of the examples directory.
See Also
mxCreateCharMatrixFromStrings, mxCreateCharArray