mxCalcSingleSubscript (Fortran)
Offset from first element to desired element
Fortran Syntax
#include "fintrf.h" mwIndex mxCalcSingleSubscript(pm, nsubs, subs) mwPointer pm mwSize nsubs mwIndex subs
Description
Call mxCalcSingleSubscript
to determine how many elements there
are between the beginning of the mxArray
and a given element of that
mxArray
. The function converts subscripts to linear
indices.
For example, given a subscript like (5,7)
,
mxCalcSingleSubscript
returns the distance from the first
element of the array to the (5,7)
element. Remember that the
mxArray
data type internally represents all data elements in a
one-dimensional array no matter how many dimensions the MATLAB®
mxArray
appears to have. For examples showing the internal
representation, see Data Storage.
Input Arguments
Returns
The number of elements, or index, between the start of the
mxArray
and the specified subscript. This number is the linear
index equivalent of the subscripts. Many Matrix Library routines (for example,
mxGetField
) require an index as an argument.
If subs
describes the starting element of an
mxArray
, mxCalcSingleSubscript
returns 0. If
subs
describes the final element of an
mxArray
, mxCalcSingleSubscript
returns
N-1
(where N
is the total number of
elements).
Version History
Introduced before R2006a