MATLAB Application Program Interface Reference Help Desk

mxCreateString

Purpose

Create a 1-by-n string mxArray initialized to the specified string

C Syntax

Arguments

str

The C string that is to serve as the mxArray's initial data.

Returns

A pointer to the created string mxArray, if successful; otherwise, returns NULL. The most likely cause of failure is insufficient free heap space.

Description

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

Free the string mxArray when you are finished using it. To free a string mxArray, call mxDestroyArray.

Examples

Create a string mxArray named s containing the value of string idiom:

For an additional example, see mxCreateString.c in the mx subdirectory of the examples directory.

See Also

mxCreateCharMatrixFromStrings, mxCreateCharArray



[ Previous | Help Desk | Next ]