User`s manual

5 Calling Java from MATLAB
5-42
can also assign [] to array elements. This stores the NULL value, rather than a
0-by-0 array, in the Java array element.
Subscripted Deletion
When you assign the empty matrix value to an entire row or column of a
MATLAB array, you find that MATLAB actually removes the affected row or
column from the array. In the example below, the empty matrix is assigned to
all elements of the fourth column in the MATLAB matrix,
matlabArray. Thus,
the fourth column is completely eliminated from the matrix. This changes its
dimensions from 4-by-5 to 4-by-4.
matlabArray = [11 12 13 14 15; 21 22 23 24 25; ...
31 32 33 34 35; 41 42 43 44 45]
matlabArray =
11 12 13 14 15
21 22 23 24 25
31 32 33 34 35
41 42 43 44 45
matlabArray(:,4) = []
matlabArray =
11 12 13 15
21 22 23 25
31 32 33 35
41 42 43 45
You can assign the empty matrix to a Java array, but the effect will be
different. The next example shows that, when the same operation is performed
on a Java array, the structure is not collapsed; it maintains its 4-by-5
dimensions.
dblArray(:,4) = []
dblArray =
java.lang.Double[][]:
[125] [125] [125] [] [125]
[250] [250] [250] [] [250]
[375] [375] [375] [] [375]
[500] [500] [500] [] [500]