| MATLAB® | ![]() |
#include "matrix.h" size_t mxGetN(const mxArray *pm);
mwSize mxGetN(pm) mwPointer pm
Pointer to an mxArray
The number of columns in the mxArray.
Call mxGetN to determine the number of columns in the specified mxArray.
If pm is an N-dimensional mxArray, mxGetN is the product of dimensions 2 through N. For example, if pm points to a four-dimensional mxArray having dimensions 13-by-5-by-4-by-6, mxGetN returns the value 120 (5 × 4 × 6). If the specified mxArray has more than two dimensions and you need to know exactly how many elements are in each dimension, call mxGetDimensions.
If pm points to a sparse mxArray, mxGetN still returns the number of columns, not the number of occupied columns.
See convec.c in the refbook subdirectory of the examples directory.
Additional examples:
fulltosparse.c, revord.c, timestwo.c, and xtimesy.c in the refbook subdirectory of the examples directory
explore.c, mexget.c, mexlock.c, mexsettrapflag.c and yprime.c in the mex subdirectory of the examples directory
mxmalloc.c, mxsetdimensions.c, mxgetnzmax.c, and mxsetnzmax.c in the mx subdirectory of the examples directory
See matdemo2.F in the eng_mat subdirectory of the examples directory for a sample program that illustrates how to use this routine in a Fortran program.
mxGetM, mxGetDimensions, mxSetM, mxSetN
![]() | mxGetM (C and Fortran) | mxGetNaN (C and Fortran) | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |