User`s manual
5 Calling Java from MATLAB
5-38
here, the statement dblArray(2,2:4) refers to a portion of the lower level
array,
dblArray(2). A new array, row2Array, is created from the elements in
columns 2 through 4.
dblArray
dblArray =
java.lang.Double[][]:
[11] [12] [13] [14] [15]
[21] [22] [23] [24] [25]
[31] [32] [33] [34] [35]
[41] [42] [43] [44] [45]
row2Array = dblArray(2,2:4)
row2Array =
java.lang.Double[]:
[22]
[23]
[24]
You also can use the colon operator in single-subscript indexing, as covered in
“Using Single Subscript Indexing to Access Arrays” on page 5-36. By making
your subscript a colon rather than a number, you can convert an array of arrays
into one linear array. The following example converts the 4-by-5 array
dblArray into a 20-by-1 linear array.
linearArray = dblArray(:)
linearArray =
java.lang.Double[]:
[11]
[12]
[13]
[14]
[15]
[21]
[22]
.
.
.