External Interfaces Reference Previous page   Next Page
mxSetJc

Set jc array of sparse mxArray

C Syntax

Arguments

array_ptr
   Pointer to a sparse mxArray.

jc
   Pointer to the jc array.

Description

Use mxSetJc to specify a new jc array for a sparse mxArray. The jc array is an integer array having n+1 elements where n is the number of columns in the sparse mxArray. The values in the jc array have the meanings:

The number of nonzero elements in any column (denoted as column C) is

For example, consider a 7-by-3 sparse mxArray named Sparrow containing six nonzero elements, created by typing

The contents of the ir, jc, and pr arrays are:

Subscript
ir
pr
jc
Comment
(2,1)
1
1
0

Column 1 contains two entries, at ir[0],ir[1]

(5,1)
4
1
2

Column 2 contains one entry, at ir[2]

(3,2)
2
1
3

Column 3 contains three entries, at ir[3],ir[4], ir[5]

(2,3)
1
2
6

There are six nonzero elements.

(5,3)
4
1


(6,3)
5
1


As an example of a much sparser mxArray, consider an 8,000 element sparse mxArray named Spacious containing only three nonzero elements. The ir, pr, and jc arrays contain:

Subscript
ir
pr
jc
Comment
(73,2)
72
1
0

Column 1 contains zero entries

(50,3)
49
1
0

Column 2 contains one entry, at ir[0]

(64,5)
63
1
1

Column 3 contains one entry, at ir[1]




2

Column 4 contains zero entries.




2

Column 5 contains one entry, at ir[3]




3

Column 6 contains zero entries.




3

Column 7 contains zero entries.




3

Column 8 contains zero entries.




3

There are three nonzero elements.

Examples

See mxsetdimensions.c in the mx subdirectory of the examples directory. For an additional example, see explore.c in the mex subdirectory of the examples directory.

See Also

mxGetIr, mxGetJc, mxSetIr


Previous page  mxSetIr mxSetLogical (Obsolete) Next page

© 1994-2005 The MathWorks, Inc.