mxArrayToString (C) - Array to string - MATLAB (original) (raw)

Main Content

C Syntax

#include "matrix.h" char *mxArrayToString(const mxArray *array_ptr);

Description

Call mxArrayToString to copy the character data of anmxCHAR array into a C-style string. The C-style string is always terminated with a NULL character and stored in column-major order. If the array contains multiple rows, then the rows are copied column-wise into a single array.

This function is similar to mxGetString, except that:

Input Arguments

expand all

Pointer to mxCHAR array, specified as const mxArray *.

Output Arguments

expand all

C-style string in local code page (LCP) encoding, specified as char *. To convert an array to a string in UTF-8 encoding, use mxArrayToUTF8String.

Returns NULL on failure. Possible reasons for failure include out of memory and specifying an array that is not an mxCHAR array.

Examples

To open an example, type:

edit([fullfile(matlabroot,"extern","examples","mex","filename")]);

where filename is:

To open an example, type:

edit([fullfile(matlabroot,"extern","examples","mx","filename")]);

where filename is:

Version History

Introduced before R2006a