| MATLAB Application Program Interface | Search  Help Desk |
| mxArrayToString | Examples See Also |
C Syntax
#include "matrix.h" char *mxArrayToString(const mxArray *array_ptr);
Arguments
array_ptrmxArray; that is, a pointer to an mxArray having the mxCHAR_CLASS class.
Returns
A C-style string. Returns NULL on out of memory.Description
CallmxArrayToString to copy the character data of a string mxArray into a C-style string. The copied C-style string starts at buf and contains no more than buflen-1 characters. The C-style string is always terminated with a NULL character.
If the string array contains several rows, they are copied, one column at a time, into one long string array. This function is similar to mxGetString, except that:
mxArrayToString does not free the dynamic memory that the char pointer points to. Consequently, you should typically free the string (using mxFree) immediately after you have finished using it.
Examples
Seemexatexit.c in the mex subdirectory of the examples directory.
For additional examples, see mxcreatecharmatrixfromstr.c and mxislogical.c in the mx subdirectory of the examples directory.
See Also
mxCreateCharArray, mxCreateCharMatrixFromStrings, mxCreateString, mxGetString