| 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" const mwSize *mxGetDimensions(const mxArray *pm);
mwPointer mxGetDimensions(pm) mwPointer pm
Pointer to the first element in the dimensions array. Each integer in the dimensions array represents the number of elements in a particular dimension. The array is not NULL terminated.
Use mxGetDimensions to determine how many elements are in each dimension of the mxArray that pm points to. Call mxGetNumberOfDimensions to get the number of dimensions in the mxArray.
To copy the values to Fortran, use mxCopyPtrToInteger4 in the following manner:
C Get dimensions of mxArray, pm
mxCopyPtrToInteger4(mxGetDimensions(pm), dims,
+ mxGetNumberOfDimensions(pm))See mxcalcsinglesubscript.c in the matlabroot/extern/examples/mx folder .
Additional examples:
findnz.c and phonebook.c in the matlabroot/extern/examples/refbook folder
explore.c in the matlabroot/extern/examples/mex folder
mxgeteps.c and mxisfinite.c in the matlabroot/extern/examples/mx folder
![]() | mxGetData (C and Fortran) | mxGetElementSize (C and Fortran) | ![]() |

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 |