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

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 292
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 90
Guidelines for Working with MWArray Classes
MWNumericArray.newInstance(dims, x1, MWClassID.DOUBLE);
MWNumericArray a2 =
MWNumericArray.newInstance(dims, x2, MWClassID.DOUBLE);
MWNumericArray a3 =
MWNumericArray.newInstance(dims, x3, MWClassID.DOUBLE);
MWNumericArray a4 =
MWNumericArray.newInstance(dims, x4, MWClassID.DOUBLE);
Similarly, the 2-by-2 matrix example can be rewritten as follows:
double[] x1 = {1.0, 3.0, 2.0, 4.0};
int[] x2 = {1, 3, 2, 4};
Double[] x3 = {new Double(1.0),
new Double(3.0),
new Double(2.0),
new Double(4.0)};
String[] x4 = {"1.0", "3.0"", "2.0", "4.0"};
int[] dims = {2, 2};
MWNumericArray a1 =
MWNumericArray.newInstance(dims, x1, MWClassID.DOUBLE);
MWNumericArray a2 =
MWNumericArray.newInstance(dims, x2, MWClassID.DOUBLE);
MWNumericArray a3 =
MWNumericArray.newInstance(dims, x3, MWClassID.DOUBLE);
MWNumericArray a4 =
MWNumericArray.newInstance(dims, x4, MWClassID.DOUBLE);
Note the order of the data in the input buffers. The matrix elements are
entered in column-wise order, which is the internal storage order used by
MATLAB.
Constructing Sparse Arrays
An efficient way to construct sparse matrices is to use the newSparse
constructor methods. The examples shown here create a 4-by-4 sparse matrix
with the following va lues:
x=[2-1 0 0
-1 2 -1 0
0-1 2-1
4-15
Przeglądanie stron 90
1 2 ... 86 87 88 89 90 91 92 93 94 95 96 ... 291 292

Komentarze do niniejszej Instrukcji

Brak uwag