User`s manual

5 Calling Java from MATLAB
5-46
Passing Data to a Java Method
When you make a call from MATLAB to Java code, any MATLAB data types
you pass in the call are converted to data types native to the Java language.
MATLAB performs this conversion on each argument that is passed, except for
those arguments that are already Java objects. This section describes the
conversion that is performed on specific MATLAB data types and, at the end,
also takes a look at how argument types affect calls made to overloaded
methods.
If data is to be returned by the method being called, MATLAB receives this
data and converts it to the appropriate MATLAB format wherever necessary.
This process is covered in the next section entitled “Handling Data Returned
from a Java Method” on page 5-56.
This section addresses the following topics:
“Conversion of MATLAB Argument Data”
“Passing Built-In Data Types”
“Passing String Arguments”
“Passing Java Objects”
“Other Data Conversion Topics”
“Passing Data to Overloaded Methods”
Conversion of MATLAB Argument Data
MATLAB data, passed as arguments to Java methods, are converted by
MATLAB into data types that best represent the data to the Java language.
The table below shows all of the MATLAB base types for passed arguments and
the Java base types defined for input arguments. Each row shows a MATLAB
type followed by the possible Java argument matches, from left to right in order
of closeness of the match. The MATLAB types (except cell arrays) can all be