User`s guide

Using Class Methods
Structure data S(1,1).f2 is 555
getData. This method returns a one-dimensional array containing a copy
of the data in the underlying MATLAB array. The
getData method of
MWStructArray ov erride s the getData method of class MWArray.
The prototype for the
getData method is
public Object getData()
getData
returns a one-dimensional array of e lements stored in column-wise
order. Before converting, a new array is derived by transforming the struct
array into a cell array such that an N-by-M-by-... struct array with P fields
is transformed into a P-by-N-by-M-by-... cell array. Each element in the
returned array is converted to a Java a rray when you call
MWArray.toArray()
on the corresponding cell.
Input Parameters
None
Example Getting Structure Array Data with getData
Get the data stored in all field s an d in dices of MWStructArray object S:
int[] sdims = {1, 2};
String[] sfields = {"f1", "f2", "f3"};
MWStructArray S = new MWStructArray(sdims, sfields);
int count = S.numberOfElements() * S.numberOfFields();
// Initialize the structure.
Integer[] val = new Integer[6];
for (int i = 0; i < count; i++)
val[i] = new Integer((i+1) * 15);
// Use getData to get data from the structure.
System.out.println("Data read from structure array S: \n");
4-127