4 Using MWArra y Classes
Exceptions
The set method throws the following exception:
IndexOutOfBoundsException
The specified index parameter is invalid.
Example — Setting an MWArray Value
Modify the data in element (2, 4)ofMWArray object A:
int[] index = {2, 4};
A.set(index, 555);
Object d_out = A.get(index);
System.out.println("Data read from A(2,4) is " +
d_out.toString());
When run, the example displays this output:
Data read from A(2,4) is 555
toArray. This method creates an array with t he same dimensionality as the
MATLAB array.
The prototype for the
toArray method is as fo llows:
public Object[] toArray()
The elements of the returned array are converted according to default
conversion rules. If the underlying MATLAB array is a complex numeric
type,
toArray returns the real part.
Input Parameters
None
4-48
Komentarze do niniejszej Instrukcji