Main Content

mxSetN (C)

Set number of columns in mxArray

C Syntax

#include "matrix.h"
void mxSetN(mxArray *pm, mwSize n);

Description

mxSetN sets the number of columns in the specified mxArray. The term columns always means the second dimension of a matrix. Calling mxSetN forces an mxArray to have two dimensions. For example, if pm points to an mxArray having three dimensions, then calling mxSetN reduces the mxArray to two dimensions.

You typically use mxSetN to change the shape of an existing mxArray. The mxSetN function does not allocate or deallocate any space for the pr, pi, ir, or jc arrays. So, if your calls to mxSetN and mxSetM increase the number of elements in the mxArray, then enlarge the pr, pi, ir, and/or jc arrays.

If calling mxSetM and mxSetN reduces the number of elements in the mxArray, then you might want to reduce the sizes of the pr, pi, ir, and/or jc arrays to use heap space more efficiently. However, reducing the size is not mandatory.

Input Arguments

expand all

Pointer to an mxArray array, specified as const mxArray*.

Number of columns, specified as mwSize.

Examples

See these examples in matlabroot/extern/examples/mx:

See these examples in matlabroot/extern/examples/refbook:

Version History

Introduced before R2006a

See Also

| |