Main Content

mxCreateString (C)

1-D array initialized to specified string

C Syntax

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

Description

Use mxCreateString to create an mxArray initialized from str.

Call mxDestroyArray when you finish using the mxArray.

Input Arguments

expand all

String, specified as const char *. This string can be encoded using UTF-8 or, for backward compatibility, the local code page (LCP) encoding.

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.

Examples

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

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

Version History

Introduced before R2006a

expand all