MATLAB Application Program Interface Reference Help Desk

mxGetScalar

Purpose

Get the real component of an mxArray's first data element

Fortran Syntax

Arguments

pm

Pointer to an mxArray.

Returns

The value of the first real (nonimaginary) element of the mxArray. If the mxArray is larger than 1-by-1, mxGetScalar returns the value of the (1,1) element.

If pm points to a sparse mxArray, mxGetScalar returns the value of the first nonzero real element in the mxArray.

If pm points to an empty mxArray, mxGetScalar returns an indeterminate value.

Description

Call mxGetScalar to get the value of the first real (nonimaginary) element of the mxArray.

In most cases, you call mxGetScalar when pm points to an mxArray containing only one element (a scalar). However, pm can point to an mxArray containing many elements. If pm points to an mxArray containing multiple elements, mxGetScalar returns the value of the first real element. If pm points to a two-dimensional mxArray, mxGetScalar returns the value of the (1,1) element.

See Also

mxGetM, mxGetN



[ Previous | Help Desk | Next ]