External Interfaces Reference Previous page   Next Page
mxCreateNumericMatrix

Create numeric matrix and initialize data elements to 0

C Syntax

Arguments

m
   The desired number of rows.

n
   The desired number of columns.

class
   The way in which the numerical data is to be represented in memory. For example, specifying mxINT16_CLASS causes each piece of numerical data in the mxArray to be represented as a 16-bit signed integer. You can specify any numeric class including mxDOUBLE_CLASS, mxSINGLE_CLASS, mxINT8_CLASS, mxUINT8_CLASS, mxINT16_CLASS, mxUINT16_CLASS, mxINT32_CLASS, mxUINT32_CLASS, mxINT64_CLASS, and mxUINT64_CLASS.

ComplexFlag
   Specify either mxREAL or mxCOMPLEX. If the data you plan to put into the mxArray has no imaginary components, specify mxREAL. If the data has some imaginary components, specify mxCOMPLEX.

Returns

A pointer to the created mxArray, if successful. mxCreateNumericMatrix is unsuccessful if there is not enough free heap space to create the mxArray. If mxCreateNumericMatrix is unsuccessful in a MEX-file, the MEX-file prints an "Out of Memory" message, terminates, and control returns to the MATLAB prompt. If mxCreateNumericMatrix is unsuccessful in a stand-alone (nonMEX-file) application, mxCreateNumericMatrix returns NULL.

Description

Call mxCreateNumericMatrix to create an 2-dimensional mxArray in which all data elements have the numeric data type specified by class. After creating the mxArray, mxCreateNumericMatrix initializes all its real data elements to 0. If ComplexFlag equals mxCOMPLEX, mxCreateNumericMatrix also initializes all its imaginary data elements to 0. mxCreateNumericMatrix allocates dynamic memory to store the created mxArray. When you finish using the mxArray, call mxDestroyArray to destroy it.

See Also

mxCreateNumericArray


Previous page  mxCreateNumericArray mxCreateScalarDouble Next page

© 1994-2005 The MathWorks, Inc.