MATLAB BUILDER JA 2 Guide de l'utilisateur Page 178

  • 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 177
4 Using MWArra y Classes
Example Getting a Boolean Value from a Logical Array
boolean[][] Adata = {{true, false, false},
{false, true, false}};
MWLogicalArray A = new MWLogicalArray(Adata);
int[] index = {2, 2};
System.out.println("A(2,2) is " + A.getBoolean(index));
When run, the example displays this output:
A(2,2) = true
set. This m ethod returns the element located at the spe cifie d one-based index
of the
MWLogicalArray object.
To set the element at a specific index, use one of the following:
public void set(int index, boolean element)
public void set(int[] index, boolean element)
Use the first syntax (int index) to return the ele ment at the specified
one-based offset in the a rray, accessing elements in column-wise order. Us e the
second syntax (
int[] index) to return the element at the specified array of
one-based indices. The first syntax offers better performance than the second.
Input Parameters
element
New element to replace at index
index
Index of the requested element in the MWLogicalArray
In the case where index is of type int, the valid range for index is 1<=index
<= N
,whereN is the total number of elements in the array.
4-102
Vue de la page 177
1 2 ... 173 174 175 176 177 178 179 180 181 182 183 ... 291 292

Commentaires sur ces manuels

Pas de commentaire