| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
#include "matrix.h" mxArray *mxCreateDoubleScalar(double value);
mwPointer mxCreateDoubleScalar(value) real*8 value
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).
Call mxCreateDoubleScalar to create a scalar double mxArray. When you finish using the mxArray, call mxDestroyArray to destroy it.
In C, you can replace the statements:
pa = mxCreateDoubleMatrix(1, 1, mxREAL); *mxGetPr(pa) = value;
with a call to mxCreateDoubleScalar:
pa = mxCreateDoubleScalar(value);
In Fortran, you can replace the statements:
pm = mxCreateDoubleMatrix(1, 1, 0) mxCopyReal8ToPtr(value, mxGetPr(pm), 1)
with a call to mxCreateDoubleScalar:
pm = mxCreateDoubleScalar(value)
![]() | mxCreateDoubleMatrix (C and Fortran) | mxCreateLogicalArray (C) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |