| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
#include "matrix.h" mxArray *mxCreateCharMatrixFromStrings(mwSize m, const char **str);
mwPointer mxCreateCharMatrixFromStrings(m, str) mwSize m character*(*) str(m)
Number of rows in the created string mxArray. The value you specify for m should equal the number of strings in str.
In C, an array of strings containing at least m strings. In Fortran, a character*n array of size m, where each element of the array is n bytes.
Pointer to the created string mxArray, if successful. If unsuccessful in a stand alone (non-MEX-file) application, mxCreateCharMatrixFromStrings returns NULL in C (0 in Fortran). 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 mxCreateCharMatrixFromStrings to be unsuccessful. Another possible reason for failure is that str contains fewer than m strings.
Use mxCreateCharMatrixFromStrings to create a two-dimensional string mxArray, where each row is initialized to a string from str. In C, the created mxArray has dimensions m-by-max, where max is the length of the longest string in str. In Fortran, the created mxArray has dimensions m-by-n, where n is the number of characters in str(i).
Note that string mxArrays represent their data elements as mxChar rather than as C char.
See mxcreatecharmatrixfromstr.c in the matlabroot/extern/examples/mx folder .
mxCreateCharArray, mxCreateString, mxGetString
![]() | mxCreateCharArray (C and Fortran) | mxCreateDoubleMatrix (C and Fortran) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |