Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mxCreateString (C and Fortran)

1-N array initialized to specified string

C Syntax

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

Fortran Syntax

mwPointer mxCreateString(str)
character*(*) str

Arguments

str

String used to initialize mxArray data

Returns

Pointer to the created mxArray, if successful. If unsuccessful in a standalone (non-MEX file) application, returns NULL in C (0 in Fortran). If unsuccessful in a MEX file, the MEX file terminates and returns control to the MATLAB® prompt. The function is unsuccessful when there is not enough free heap space to create the mxArray.

Description

Use mxCreateString to create an mxArray initialized to str. Many MATLAB functions (for example, strcmp and upper) require string array inputs.

Free the mxArray when you are finished using it, by calling mxDestroyArray.

Examples

See the following examples in matlabroot/extern/examples/refbook.

See the following examples in matlabroot/extern/examples/mx.

See the following examples in matlabroot/extern/examples/eng_mat.

Introduced before R2006a

Was this topic helpful?