Main Content

mxCreateDoubleScalar (C)

Scalar, double-precision array initialized to specified value

C Syntax

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

Description

Call mxCreateDoubleScalar to create a scalar mxArray of type mxDouble.

You can use mxCreateDoubleScalar instead of mxCreateDoubleMatrix in the following situation.

Replace:With:
pa = mxCreateDoubleMatrix(1, 1, mxREAL);
*mxGetDoubles(pa) = value;
pa = mxCreateDoubleScalar(value);

Call mxDestroyArray when you finish using the mxArray.

Input Arguments

expand all

Scalar value, specified as double.

Output Arguments

expand all

Pointer to an mxArray of type mxDouble, specified as mxArray *, if successful.

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 NULL.

Version History

Introduced before R2006a