MATLAB BUILDER JA 2 Guida Utente Pagina 122

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 292
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 121
4 Using MWArra y Classes
Example—GettinganMWArrayValuewithget
Retrieve element (2, 4) from array object A:
int[] index = {2, 4};
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 10
getData. This method returns a ll elements of the MWArray object. Elements
are returned in a one-dimensional array, in column-wise order. Elements
are returned as type
Object.
The prototype for the
getData method is as fo llows:
public Object getData()
Input Parameters
None
The elements of the returned array are converted according to default
conversion rules. If the underlying MATLAB array is a complex numeric
type,
getData returns the real part.
Example Ge tting an MWArray Value with getData
Get the data from MWArray object A , casting the type from Object to int:
System.out.println("Data read from matrix A is:");
int[] x = (int[]) A.getData();
for (int i = 0; i < x.length; i++)
System.out.print(" " + x[i]);
4-46
Vedere la pagina 121
1 2 ... 117 118 119 120 121 122 123 124 125 126 127 ... 291 292

Commenti su questo manuale

Nessun commento