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

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 292
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 178
Using Class Methods
Inthecasewhereindex is of type int[],eachelementoftheindex vector
is an index along one dimension of the
MWLogicalArray object. The valid
range for any index is
1 <= index[i] <= N[i],whereN[i] is the size of the
ith dimension.
Exceptions
The set method throws the following exception:
IndexOutOfBoundsException
The specified index parameter is invalid.
Example—SettingaValueinaLogicalArray
Get and modify the value at A(2,3):
boolean[][] Adata = {{true, false, false},
{false, true, false}};
MWLogicalArray A = new MWLogicalArray(Adata);
int[] index = {2, 3};
Object d_out = A.get(index);
System.out.println("Array element A(2,3) is " +
d_out.toString() + "\n");
System.out.println("Setting A(2,3) to true\n");
A.set(index, true);
d_out = A.get(index);
System.out.println("Array element A(2,3) is " +
d_out.toString() + "\n");
When run, the example displays this output:
Array element A(2,3) is false
4-103
Przeglądanie stron 178
1 2 ... 174 175 176 177 178 179 180 181 182 183 184 ... 291 292

Komentarze do niniejszej Instrukcji

Brak uwag