MATLAB BUILDER JA 2 Guide de l'utilisateur Page 112

  • 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 111
4 Using MWArra y Classes
}
}
finally
{
if (c != null)
c.dispose();
}
}
This method loops through the array and prints the type of each ce ll. The
temporary array returned by
getCell is disposed of after it is used. The
finally clause ensures that the array is disposed of before exiting, in the
case of an exception.
MWCellArray also override s the MWArray.get methods.
In this case, a Java array is returned that represents a conversion of the
underlying cell, as would b e returned by
toArray.
Using get. Yo u can thi nk of
get as being implemented as follows:
Object get(int index)
{
MWArray a = null;
try
{
a = this.getCell(index);
return a.toArray();
}
finally
{
if (a != null)
a.dispose();
}
}
Using get, you can retrieve the cells from the first MWCellArray example
as Java arrays.
int[] index = {1, 1};
String x11 = (String)a.get(index);
4-36
Vue de la page 111
1 2 ... 107 108 109 110 111 112 113 114 115 116 117 ... 291 292

Commentaires sur ces manuels

Pas de commentaire