Skip navigation links

Package com.mathworks.extern.java

This package provides classes that represent MATLAB struct and cell array datatypes.

See: Description

Package com.mathworks.extern.java Description

This package provides classes that represent MATLAB struct and cell array datatypes. The classes in this package have the same names as corresponding classes in the com.mathworks.toolbox.javabuilder package.

The main difference between the two packages is that classes in this package do not need MATLAB Runtime. In terms of public API, these classes offer only a subset of methods offered by their counterparts in the com.mathworks.toolbox.javabuilder package. Classes in this package do not provide methods that depend on MATLAB Runtime.

The struct and cell array classes in this package can be referred to as native struct and cell arrays.

Note: This package is meant to be used only with a MATLAB Java Package component that is being used in a Java RMI based application where the client machine does not have MATLAB Runtime installed. It should be used for only those MATLAB function calls that have either struct or cell arrays as inputs or outputs. This package should not be used with standalone applications.

Motivation

The users of MATLAB Java Package components with RMI have control over how the server sends the results of MATLAB function calls back to the client. The server can be set to marshal the output to the client as a com.mathworks.toolbox.javabuilder.MWArray subtype or as a Java native data type. Since the com.mathworks.toolbox.javabuilder.MWArray class hierarchy can be used only in the presence of a MATLAB Runtime, the availability of MATLAB Runtime on the client machine determines how the server should be set for marshaling MATLAB function results. If the client machine does not have MATLAB Runtime, the server should be set to marshal the results as native types. When this is done, the server returns the output of the toArray() method of com.mathworks.toolbox.javabuilder.MWArray subtypes.

The native data type representations of com.mathworks.toolbox.javabuilder.MWArray subtypes (the output of the toArray() method) corresponding to logical, numeric and string MATLAB data types are easier to deal with. For struct and cell arrays, which are specific to MATLAB, there is no direct representation available in Java. As a result, when an instance of MWStructArray or MWCellArray is converted to a Java native type using the toArray() method, the users get a multi dimensional Object array which is hard to comprehend. MWStructArray and MWCellArray classes from this package provide a solution to this problem.

If the server is set to marshal the native types, the com.mathworks.extern.java package converts the MATLAB struct or cell into a com.mathworks.extern.java.MWStructArray or com.mathworks.extern.java.MWCellArray, respectively, instead of returning the output of toArray() to the client.

Skip navigation links

© 1994-2017 The MathWorks, Inc. Patents Trademarks