| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB Builder JA |
| Contents | Index |
| Learn more about MATLAB Builder JA |
| On this page… |
|---|
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 builder to the correct MWArray type 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 java.lang.Double, which converts to a MATLAB 1-by-1 double array.
The conversion rules apply not only when calling your own methods, but also when calling constructors and factory methods belonging to the MWArray classes. For example, the following code calls the constructor for the MWNumericArray class with a Java double input. The MATLAB Builder JA product converts the Java double input to an instance of MWNumericArray having a ClassID property of MWClassID.DOUBLE. This is the equivalent of a MATLAB 1-by-1 double array.
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
There is an exception: if you supply a specific data type in the same constructor, the MATLAB Builder JA product converts to that type rather than following the default conversion rules. Here, the code specifies that A should be constructed as a MATLAB 1-by-1 16-bit integer array:
double Adata = 24;
MWNumericArray A = new MWnumericArray(Adata, MWClassID.INT16);
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 int16
Use the 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.
Search on renderArrayData in the Javadoc for information on input parameters, return values, exceptions thrown, and examples.
For a complete example of renderArrayData's implementation, see Buffered Image Creation Example.
![]() | Dynamically Specifying Run-Time Options to the MCR | Setting Java Properties | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |