This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

mxCreateCharMatrixFromStrings (C)

2-D mxChar array initialized to specified value

C Syntax

#include "matrix.h"
mxArray *mxCreateCharMatrixFromStrings(mwSize m, const char **str);


Use mxCreateCharMatrixFromStrings to create a two-dimensional mxArray, where each row is initialized to a string from str. The mxArray has dimensions m-by-max, where max is the length of the longest string in str.

The mxArray represents its data elements as mxChar rather than as C char.

Input Arguments

expand all

Number of strings, specified as mwSize.

Array of strings, specified as const char **. The array must contain at least m strings.

Output Arguments

expand all

Pointer to an mxArray of type mxChar, specified as mxArray *.

The function is unsuccessful when str contains fewer than m strings or there is not enough free heap space to create the mxArray.

  • MEX file — Function terminates the MEX file and returns control to the MATLAB® prompt.

  • Standalone (non-MEX file) application — Function returns NULL.


See these examples in matlabroot/extern/examples/mx:

Introduced before R2006a