Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

mxCreateString (C and Fortran) - Create 1-by-N string mxArray initialized to specified string

C Syntax

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

Fortran Syntax

mwPointer mxCreateString(str)
character*(*) str

Arguments

str

String that is to serve as the mxArray's initial data

Returns

Pointer to the created string mxArray if successful, and NULL in C (0 in Fortran) otherwise. 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.

C Examples

See revord.c in the matlabroot/extern/examples/refbook folder .

For additional examples, see mxcreatestructarray.c and mxisclass.c in the matlabroot/extern/examples/mx folder .

Fortran Examples

See matdemo1.F in the matlabroot/extern/examples/eng_mat folder for sample programs that illustrate how to use the MAT-file routines in a Fortran program.

See Also

mxCreateCharMatrixFromStrings, mxCreateCharArray

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS