MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Manual de usuario Pagina 213

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 408
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 212
Working with Java Arrays
5-43
The dblArray data structure s actually an array of five-element arrays of
java.lang.Double objects. The empty array assignment placed the NULL value
in the fourth element of each of the lower level arrays.
Concatenating Java Arrays
You can concatenate arrays of Java objects in the same way as arrays of other
data types. (To understand how scalar Java objects are concatenated by
MATLAB see “Concatenating Java Objects” on page 5-12.)
Use either the
cat function or the square bracket ([]) operators. This example
horizontally concatenates two Java arrays:
d1, and d2.
% Construct a 2-by-3 array of java.lang.Double.
d1 = javaArray('java.lang.Double',2,3);
for m = 1:3 for n = 1:3
d1(m,n) = java.lang.Double(n*2 + m-1);
end; end;
d1
d1 =
java.lang.Double[][]:
[2] [4] [6]
[3] [5] [7]
[4] [6] [8]
% Construct a 2-by-2 array of java.lang.Double.
d2 = javaArray('java.lang.Double',2,2);
for m = 1:3 for n = 1:2
d2(m,n) = java.lang.Double((n+3)*2 + m-1);
end; end;
d2
d2 =
java.lang.Double[][]:
[ 8] [10]
[ 9] [11]
[10] [12]
Vista de pagina 212
1 2 ... 208 209 210 211 212 213 214 215 216 217 218 ... 407 408

Comentarios a estos manuales

Sin comentarios