MATLAB BUILDER JA 2 Guía de usuario Pagina 202

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 292
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 201
4 Using MWArra y Classes
index
Index of the requested element in the MWStructArray
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.
Inthecasewhere
index is of type int[],eachelementoftheindex vector
is an index along one dimension of the
MWStructArray object. T he valid
range for any index is
1 <= index[i] <= N[i],whereN[i] is the size of the
ith dimension.
Exceptions
The get method throws the following exception:
IndexOutOfBoundsException
The specified index parameter is invalid.
Example Getting Struct ure Array Data with get
Get the data stored in field f2 at index (1,1) of MWStructArray object S:
int[] sdims = {1, 2};
String[] sfields = {"f1", "f2", "f3"};
Integer val = new Integer(555);
MWStructArray S = new MWStructArray(sdims, sfields);
int[] index = {1, 1};
S.set(sfields[2], index, val);
Object d_out = S.get(sfields[2], index);
System.out.println("Structure data S(1,1).f2 is " +
d_out.toString());
When run, the example displays this output:
4-126
Vista de pagina 201
1 2 ... 197 198 199 200 201 202 203 204 205 206 207 ... 291 292

Comentarios a estos manuales

Sin comentarios