MATLAB BUILDER JA 2 Guide de l'utilisateur Page 122

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 292
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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
Vue de la page 121
1 2 ... 117 118 119 120 121 122 123 124 125 126 127 ... 291 292

Commentaires sur ces manuels

Pas de commentaire