The call signature for a method that encapsulates a MATLAB® function
uses one of the MATLAB data conversion classes to pass arguments
and return output. When you call any such method, all input arguments
not derived from one of the
MWArray classes are
converted by the compiler to the correct
before being passed to the MATLAB method.
For example, consider the following Java® statement:
result = theFourier.plotfft(3, data, new Double(interval));
The third argument is of type
which converts to a MATLAB 1-by-1
See Rules for Data Conversion Between Java and MATLAB for a complete list of rules to convert between Java and MATLAB Compiler SDK™ data types.
The conversion rules apply not only when calling your own methods,
but also when calling constructors and factory methods belonging to
MWArray classes. For example, the following
code calls the constructor for the
with a Java
double input. The MATLAB
Compiler SDK product
converts the Java
double input to an instance
MWNumericArray having a
MWClassID.DOUBLE. This is the equivalent of
a MATLAB 1-by-1
double Adata = 24; MWNumericArray A = new MWNumericArray(Adata); System.out.println("Array A is of type " + A.classID());
When you run this example, the results are as follows:
Array A is of type double
To specify the MATLAB to Java type conversion, you supply a specific data type in the constructor. The MATLAB Compiler SDK product converts to the specified type rather than following the default conversion rules.
The following code specifies that
be constructed as a MATLAB 1-by-1 16-bit integer array:
double Adata = 24; MWNumericArray A = new MWNumericArray(Adata, MWClassID.INT16);
renderArrayData method to:
Create a buffered image from data in a given MATLAB array.
Verify the array is of three dimensions (height, width, and color component).
Verify the color component order is red, green, and blue.
renderArrayData in the Javadoc
for information on input parameters, return values, exceptions thrown,
and examples. The Javadoc is located at