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.

mxCreateString (C)

1-N array initialized to specified string

C Syntax

#include "matrix.h"
mxArray *mxCreateString(const char *str);


Use mxCreateString to create an mxArray initialized to str. Many MATLAB® functions, such as strcmp and upper, require string array inputs.

mxCreateString supports both multibyte and single-byte encoded characters. On Windows® and Linux® platforms, the user locale setting specifies the default encoding.

Call mxDestroyArray when you finish using the mxArray.

Input Arguments

expand all

String, specified as const char *. Only ASCII characters are supported.

Output Arguments

expand all

Pointer to an mxArray, specified as mxArray *, if successful.

The function is unsuccessful when 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/refbook:

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

Introduced before R2006a