External Interfaces/API Reference    
mxCreateCharMatrixFromStrings

Create populated two-dimensional string mxArray

C Syntax

Arguments

m
   The desired number of rows in the created string mxArray. The value you specify for m should equal the number of strings in str.

str
   A pointer to a list of strings. The str array must contain at least m strings.

Returns

A pointer to the created string mxArray, 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

Use mxCreateCharMatrixFromStrings 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.

Examples

See mxcreatecharmatrixfromstr.c in the mx subdirectory of the examples directory.

See Also

mxCreateCharArray, mxCreateString, mxGetString


  mxCreateCharArray mxCreateDoubleMatrix