MATLAB BUILDER JA 2 Podręcznik Użytkownika Strona 222

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 292
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 221
4 Using MWArra y Classes
toArray. This method returns an array containing a copy of the data in t h e
underlying MATLAB array.
The prototype for the
toArray method is as fo llows:
public Object[] toArray()
toArray
returns an array with the same dim ensionality as the MATLAB
array. Each element in the returned array is converted to a Java array when
you call
MWArray.toArray() on the corresponding cell.
Input Parameters
None
Example Getting Cell Array Data with toArray
int[] cdims = {1, 3};
MWCellArray C = new MWCellArray(cdims);
System.out.println("Data read from cell array C \n");
Object x = (Object) C.toArray();
System.out.println();
for (int i = 0; i < x[0].length; i++)
System.out.println(x[0][i]);
When run, the example displays this output:
Data read from cell array C
[]
[]
[]
4-146
Przeglądanie stron 221
1 2 ... 217 218 219 220 221 222 223 224 225 226 227 ... 291 292

Komentarze do niniejszej Instrukcji

Brak uwag