External Interfaces/API Reference    
mxGetN

Get the total number of columns in a two-dimensional mxArray or the total number of elements in dimensions 2 through N for an m-by-n array.

C Syntax

Arguments

array_ptr
   Pointer to an mxArray.

Returns

The number of columns in the mxArray.

Description

Call mxGetN to determine the number of columns in the specified mxArray.

If array_ptr is an N-dimensional mxArray, mxGetN is the product of dimensions 2 through N. For example, if array_ptr points to a four-dimensional mxArray having dimensions 13-by-5-by-4-by-6, then mxGetN returns the value 120 (5x4x6). If the specified mxArray has more than two dimensions and you need to know exactly how many elements are in each dimension, then call mxGetDimensions.

If array_ptr points to a sparse mxArray, mxGetN still returns the number of columns, not the number of occupied columns.

Examples

See convec.c in the refbook subdirectory of the examples directory.

For additional examples,

See Also

mxGetM, mxGetNumberOfDimensions, mxSetM, mxSetN


  mxGetM mxGetName (Obsolete)