User`s manual

5 Calling Java from MATLAB
5-30
How MATLAB Represents the Java Array
The term java array refers to any array of Java objects returned from a call to
a Java class constructor or method. You may also construct a Java array within
MATLAB using the
javaArray function. The structure of a Java array is
significantly different from that of a MATLAB matrix or array. MATLAB hides
these differences whenever possible, allowing you to operate on the arrays
using the usual MATLAB command syntax. Just the same, it may be helpful to
keep the following differences in mind as you work with Java arrays.
Representing More Than One Dimension
An array in the Java language is strictly a one-dimensional structure because
it is measured only in length. If you want to work with a two-dimensional
array, you can create an equivalent structure using an array of arrays. To add
further dimensions, you add more levels to the array, making it an array of
arrays of arrays, and so on. You may want to use such multilevel arrays when
working in MATLAB as it is a matrix and array-based programming language.
MATLAB makes it easy for you to work with multilevel Java arrays by treating
them like the matrices and multidimensional arrays that are a part of the
language itself. You access elements of an array of arrays using the same
MATLAB syntax that you would use if you were handling a matrix. If you were
to add more levels to the array, MATLAB would be able to access and operate
on the structure as if it were a multidimensional MATLAB array.
The left side of the following figure shows Java arrays of one, two, and three
dimensions. To the right of each is the way the same array is represented to
you in MATLAB. Note that single-dimension arrays are represented as a
column vector.