Main Content

mxCreateCharArray (C)

N-DmxChararray

C Syntax

#include "matrix.h" mxArray *mxCreateCharArray(mwSize ndim, const mwSize *dims);

Description

UsemxCreateCharArrayto create an N-dimensionalmxChararray with each element set toNULL.

MATLAB®automatically removes any trailing singleton dimensions specified in thedims论点。例如,如果ndimequals5anddimsequals[4 1 7 1 1], then the resulting array has the dimensions4-by-1-by-7.

Input Arguments

expand all

Number of dimensions, specified asmwSize. If you specify 0, 1, or 2, thenmxCreateCharArraycreates a two-dimensionalmxArray.

Dimensions array, specified asconst mwSize *.

Each element in the dimensions array contains the size of the array in that dimension. For example, to create a5-by-7array, setdims[0]to 5 anddims[1]to 7.

Usually, thedimsarray containsndimelements.

Output Arguments

expand all

Pointer to anmxArrayof typemxChar, specified asmxArray *.

The function is unsuccessful when there is not enough free heap space to create themxArray.

  • MEX file — Function terminates the MEX file and returns control to the MATLAB prompt.

  • Standalone (non-MEX file) application — Function returnsNULL.

Version History

Introduced before R2006a