Main Content

mxCreateCharArray (Fortran)

N-D mxChar array

Fortran Syntax

#include "fintrf.h"
mwPointer mxCreateCharArray(ndim, dims)
mwSize ndim
mwSize dims(ndim)


Use mxCreateCharArray to create an N-dimensional mxChar array with each element set to 0.

MATLAB® automatically removes any trailing singleton dimensions specified in the dims argument. For example, if ndim equals 5 and dims equals [4 1 7 1 1], then the resulting array has the dimensions 4-by-1-by-7.

Input Arguments

expand all

Number of dimensions, specified as mwSize. If you specify 0, 1, or 2, then mxCreateCharArray creates a two-dimensional mxArray.

Dimensions array, specified as an array of mwSize.

Each element in the dimensions array contains the size of the array in that dimension. For example, to create a 5-by-7 array, set dims(1) to 5 and dims(2) to 7.

Usually, the dims array contains ndim elements.

Output Arguments

expand all

Pointer to an mxArray of type mxChar, specified as mwPointer.

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.

Version History

Introduced before R2006a