MATLAB Application Program Interface
  Go to function:
    Search    Help Desk 
mxCreateDoubleMatrix    Examples   See Also

Create an unpopulated 2-dimensional, double-precision, floating-point mxArray

C Syntax

Arguments

m
  The desired number of rows.

n
  The desired number of columns.

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. If unsuccessful in a stand-alone (nonMEX-file) application, mxCreateDoubleMatrix returns NULL. If unsuccessful in a MEX-file, the MEX-file terminates and control returns to the MATLAB prompt. mxCreateDoubleMatrix is unsuccessful when there is not enough free heap space to create the mxArray.

Description

Use mxCreateDoubleMatrix to create an m-by-n mxArray. mxCreateDoubleMatrix initializes each element in the pr array to 0. If you set ComplexFlag to mxCOMPLEX, mxCreateDoubleMatrix also initializes each element in the pi array to 0.

If you set ComplexFlag to mxREAL, mxCreateDoubleMatrix allocates enough memory to hold m-by-n real elements. If you set ComplexFlag to mxCOMPLEX, mxCreateDoubleMatrix allocates enough memory to hold m-by-n real elements and m-by-n imaginary elements.

Call mxDestroyArray when you finish using the mxArray. mxDestroyArray deallocates the mxArray and its associated real and complex elements.

Examples

Create a 2-by-4 double-precision, floating-point mxArray, then populate it:

For an additional example, see mxcreatedoublematrix.c in the mx subdirectory of the examples directory.

See Also

mxCreateNumericArray, mxComplexity



[ Previous | Help Desk | Next ]