Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

mxSetM (C and Fortran) - Set number of rows in mxArray

C Syntax

#include "matrix.h"
void mxSetM(mxArray *pm, mwSize m);

Fortran Syntax

mxSetM(pm, m)
mwPointer pm
mwSize m

Arguments

pm

Pointer to an mxArray

m

Number of rows

Description

Call mxSetM to set the number of rows in the specified mxArray. The term rows means the first dimension of an mxArray, regardless of the number of dimensions. Call mxSetN to set the number of columns.

You typically use mxSetM to change the shape of an existing mxArray. Note that mxSetM does not allocate or deallocate any space for the pr, pi, ir, or jc arrays. Consequently, if your calls to mxSetM and mxSetN increase the number of elements in the mxArray, you must enlarge the pr, pi, ir, and/or jc arrays. Call mxRealloc to enlarge them.

If your calls to mxSetM and mxSetN end up reducing the number of elements in the mxArray, you may want to reduce the sizes of the pr, pi, ir, and/or jc arrays in order to use heap space more efficiently. However, reducing the size is not mandatory.

C Examples

See mxsetdimensions.c in the matlabroot/extern/examples/mx folder . For an additional example, see sincall.c in the matlabroot/extern/examples/refbook folder .

See Also

mxGetM, mxGetN, mxSetN

  


Recommended Products

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