User`s manual

Working with Java Arrays
5-33
When the size function is applied to a Java array of arrays, the resulting value
describes the top level of the specified array. For the Java array shown here
size(A) returns the dimensions of the highest array level of A. The highest
level of the array has a size of 3-by-1.
size(A)
ans =
3 1
To find the size of a lower level array, say the five-element array in row 3, refer
to the row explicitly.
size(A(3))
ans =
5 1
You can specify a dimension in the size command using the following syntax.
However, you will probably find this useful only for sizing the first dimension,
dim=1, as this will be the only non-unary dimension.
m = size(X,dim)
size(A, 1)
ans =
3
Interpreting the Number of Dimensions of a Java Arrays
For Java arrays, whether they are simple one-level arrays or multilevel, the
MATLAB
ndims function always returns a value of 2 to indicate the number of
dimensions in the array. This is a measure of the number of dimensions in the
top-level array which will always be equal to 2.
size(A) = 3x1
size(A(3)) = 5x1