mxCreateDoubleScalar (C and Fortran)

Create scalar, double-precision array initialized to specified value

C Syntax

#include "matrix.h"
mxArray *mxCreateDoubleScalar(double value);

Fortran Syntax

mwPointer mxCreateDoubleScalar(value)
real*8 value

Arguments

value

The desired value to which you want to initialize the array

Returns

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

Description

Call mxCreateDoubleScalar to create a scalar double mxArray. mxCreateDoubleScalar is a convenience function that can be used in place of the following C code:

pa = mxCreateDoubleMatrix(1, 1, mxREAL);
*mxGetPr(pa) = value;

mxCreateDoubleScalar can be used in place of the following Fortran code:

pm = mxCreateDoubleMatrix(1, 1, 0)
mxCopyReal8ToPtr(value, mxGetPr(pm), 1)

When you finish using the mxArray, call mxDestroyArray to destroy it.

See Also

mxGetPr, mxCreateDoubleMatrix

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS