User`s manual

Working with Java Arrays
5-41
[ 21] [ 22] [ 23] [ 24] [ 25]
[100] [200] [300] [400] [500]
[ 41] [ 42] [ 43] [ 44] [ 45]
Assigning to a Linear Array
You can assign a value to every element of a multidimensional Java array by
treating the array structure as if it were a single linear array. This entails
replacing the single, numerical subscript with the MATLAB colon operator. If
you start with the
dblArray array, you can initialize the contents of every
object in the two-dimensional array with the following statement.
dblArray(:) = java.lang.Double(0)
dblArray =
java.lang.Double[][]:
[0] [0] [0] [0] [0]
[0] [0] [0] [0] [0]
[0] [0] [0] [0] [0]
[0] [0] [0] [0] [0]
Using the Colon Operator
You can use the MATLAB colon operator as you would when working with
MATLAB arrays. The statements below assign given values to each of the four
rows in the Java array,
dblArray. Remember that each row actually represents
a separate Java array in itself.
dblArray(1,:) = java.lang.Double(125);
dblArray(2,:) = java.lang.Double(250);
dblArray(3,:) = java.lang.Double(375);
dblArray(4,:) = java.lang.Double(500)
dblArray =
java.lang.Double[][]:
[125] [125] [125] [125] [125]
[250] [250] [250] [250] [250]
[375] [375] [375] [375] [375]
[500] [500] [500] [500] [500]
Assigning the Empty Matrix
When working with MATLAB arrays, you can assign the empty matrix, (i.e.,
the 0-by-0 array denoted by []) to an element of the array. For Java arrays, you