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

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 292
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 212
Using Class Methods
Example Constructing an Empty Cell Array Object
This first example creates an empty MWCellArray object:
MWCellArray C = new MWCellArray();
System.out.println("C = " + C.toString());
When run, the example displays this output:
C=[]
Example Constructing an Initialized Cell Array Object
The second example cons tructs and initializes a 2-by-3 MWCellArray object:
int[] cdims = {2, 3};
MWCellArray C = new MWCellArray(cdims);
Integer[] val = new Integer[6];
for(inti=0;i<6;i++)
val[i] = new Integer(i * 15);
for(inti=0;i<2;i++)
for(intj=0;j<3;j++)
{
int[] idx = {i+1, j+1};
C.set(idx, val[j + (i * 3)]);
}
System.out.println("C = " + C.toString());
When run, the example displays this output:
C = [ 0] [15] [30]
[45] [60] [75]
Methods to Destroy an MWCellArray
To destroy the arrays, use either dispose or disposeArray.
4-137
Przeglądanie stron 212
1 2 ... 208 209 210 211 212 213 214 215 216 217 218 ... 291 292

Komentarze do niniejszej Instrukcji

Brak uwag