User`s guide

4 Using MWArra y Classes
Exceptions
These methods throw the following exception:
IndexOutOfBoundsException
The specified index parameter is invalid.
toImagArray. This method returns an array containing a copy of the
imaginary data in the underlying MATLAB array.
The prototype for the
toImagArray method is
public Object toImagArray()
The array that is returned has the same dimensionality as the MATLAB array.
The elements of this array are converted according to default conversion rules.
Input Parameters
None
Example Getting Complex Data with toImagArray
Using the same array as in the example for “getImag” on pag e 4-81, get and
display a copy of the imaginary part of that array:
double[][] x = (double[][]) A.toImagArray();
int[] dimA = A.getDimensions();
System.out.println("The imaginary part of matrix A is:");
for (int i = 0; i < dimA[0]; i++)
{
for (int j = 0; j < dimA[1]; j++)
System.out.print(" " + x[i][j]);
System.out.println();
}
4-86