User`s manual
Working with Java Arrays
5-29
Working with Java Arrays
You can pass singular Java objects to and from methods or you may pass them
in an array, providing the method expects them in that form. This array must
either be a Java array (returned from another method call or created within
MATLAB) or, under certain circumstances, a MATLAB cell array. This section
describes how to create and manipulate Java arrays in MATLAB. Later
sections will describe how to use MATLAB cell arrays in calls to Java methods.
Note The term dimension here refers more to the number of subscripts
required to address the elements of an array than to its length, width, and
height characteristics. For example, a 5-by-1 array is referred to as being
one-dimensional, as its individual elements can be indexed into using only one
array subscript.
This section addresses the following topics:
•“How MATLAB Represents the Java Array”
•“Creating an Array of Objects Within MATLAB”
•“Accessing Elements of a Java Array”
•“Assigning to a Java Array”
•“Concatenating Java Arrays”
•“Creating a New Array Reference”
•“Creating a Copy of a Java Array”