Using Class Methods
index
Index of the requested element in the MWCellArray
In the case where index is of type int, the valid range for index is 1<=index
<= N
,whereN is the total number of elements in the array.
Inthecasewhere
index is of type int[],eachelementoftheindex vector
is an index along one dimension of the
MWCellArray object. The valid range
for any index is
1 <= index[i] <= N[i],whereN[i] isthesizeoftheith
dimension.
Exceptions
The set method throws the following exception:
IndexOutOfBoundsException
The specified index parameter is invalid.
Example — Setting Values in a Cell Array
Set the value o f the MWCellArray object C at index (1,3):
int[] cdims = {1, 3};
MWCellArray C = new MWCellArray(cdims);
Integer val = new Integer(15);
int[] index = {1, 3};
C.set(index, val);
Object x = C.get(index);
System.out.println("Cell data C(1,3) is " + x.toString());
When run, the example displays this output:
Cell data C(1,3) is 15
4-145
Komentarze do niniejszej Instrukcji