External Interfaces Reference Previous page   Next Page
mxSetDimensions

Modify number of dimensions and size of each dimension

Fortran Syntax

Arguments

pm
   Pointer to an mxArray.

dims
   The dimensions array. Each element in the dimensions array contains the size of the array in that dimension. For example, setting dims(1) to 5 and dims(2) to 7 establishes a 5-by-7 mxArray. In most cases, there should be ndim elements in the dims array.

ndim
   The desired number of dimensions.

Returns

0 on success, and 1 on failure. mxSetDimensions allocates heap space to hold the input size array. So it is possible (though extremely unlikely) that increasing the number of dimensions can cause the system to run out of heap space.

Description

Call mxSetDimensions to reshape an existing mxArray. mxSetDimensions is similar to mxSetM and mxSetN; however, mxSetDimensions provides greater control for reshaping mxArrays that have more than two-dimensions.

mxSetDimensions does not allocate or deallocate any space for the pr or pi array. Consequently, if your call to mxSetDimensions increases the number of elements in the mxArray, then you must enlarge the pr (and pi, if it exists) array accordingly.

If your call to mxSetDimensions reduces the number of elements in the mxArray, then you can optionally reduce the size of the pr and pi arrays using mxRealloc.

See Also

mxGetNumberOfDimensions, mxSetM, mxSetN


Previous page  mxSetData mxSetField Next page

© 1994-2005 The MathWorks, Inc.