Main Content

mxCreateString (Fortran)

1-D array initialized to specified string

Fortran Syntax

#include "fintrf.h"
mwPointer mxCreateString(str)
character*(*) str

Description

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 character*(*). Only ASCII characters are supported.

Output Arguments

expand all

Pointer to an mxArray of type mxChar, specified as mwPointer, 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 0.

Examples

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

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

Version History

Introduced before R2006a