|MATLAB Release Notes|
External Interfaces/API Features
MATLAB Interface to Java
The new Java capability enables you to conveniently bring Java classes into the MATLAB environment, to construct objects from those classes, to call methods on the Java objects, and to save Java objects for later reloading -- all accomplished with MATLAB functions and commands. You can also develop your own Java class definitions and make them available for use in MATLAB.
The MATLAB Java interface is intended for all MATLAB users who want to take advantage of the special capabilities of the Java programming language. The interface enables you to
URLclass provides convenient access to resources on the internet.
You construct Java objects in MATLAB by calling the Java class constructor, which has the same name as the class. For example, the following constructor creates a
Frame object with the title
'Frame A'. Any other properties are set to their default values.
You call methods on this object using either Java syntax
Or MATLAB syntax.
You can create n-dimensional arrays of Java objects and call methods on the arrays. You reference and assign to elements of those arrays using MATLAB matrix syntax. You can pass either MATLAB data or Java objects to the methods of Java classes. MATLAB performs data type conversion on this data where necessary.
See Calling Java from MATLAB under "External Interfaces/API" in the online help, for full documentation of this feature.
New Functions for the Interface to Java
MATLAB 6.0 provides the following new functions to support the interface to Java.
||Add to the current Java packages import list
||Test whether an object is a Java object
||Construct a Java array
||Invoke a Java method (used only in special cases)
||Construct a Java object (used only in special cases)
||Display information on all methods implemented by a Java or MATLAB class
Existing Functions with Java Functionality Added
The following MATLAB functions now operate on Java objects, classes, and methods.
||Convert a Java object array into a MATLAB cell array
||Return a Java class name
||Remove the Java packages import list
||Return Java class names that the file and its subordinates use
||Display a Java object
||Convert a Java object or array to a double array
||Determine if a Java class exists
||Return the field names of a Java object
||Return the names of loaded Java classes
||Identify an object as a Java class
||Compare Java objects for equality
||Return all methods of a Java class
||Convert a Java object or array to a MATLAB structure or structure array
||Return the package, class, and method name for a Java class method
Restriction on Unloading Java Classes
If you load a Java class into MATLAB and, sometime later, modify and recompile the class, you must exit and restart MATLAB in order to use the updated class definition. This restriction exists because the Java VM does not provide a way to unload a Java class once it has been loaded. Exiting and restarting MATLAB terminates and restarts the Java VM, which then allows you to load the updated class.
import function will not import an updated class definition. You must first exit and restart MATLAB.
The Java version used by MATLAB differs by platform and for Release 12 is as shown in the following table.
To see the Java version used by MATLAB, type
version -java in the command window.
New C Language mx Functions
mx functions are new in this release.
||Create a numeric matrix and initialize all its data elements to 0
||Create a scalar, double-precision array initialized to the specified value
Additional Supported Compilers
MATLAB now includes preconfigured options files for these compilers:
Using the Add-In for Visual Studio
The MathWorks provides a MATLAB add-in for the Visual Studio® development system that lets you work easily within Microsoft Visual C/C++ (MSVC). The MATLAB add-in for Visual Studio greatly simplifies using M-files in the MSVC environment. The add-in automates the integration of M-files into Visual C++ projects. It is fully integrated with the MSVC environment.
The add-in for Visual Studio is automatically installed on your system when you run either
mbuild -setup or
mex -setup and select Microsoft Visual C/C++ version 5 or 6.
However, there are several steps you must follow in order to use the add-in:
mexto use the selected Microsoft compiler and also installs the necessary add-in files in your Microsoft Visual C/C++ directories.
<matlab>\bin\win32as the filename, and select
Add-ins (.dll)from the Files of Type pulldown list.
If Windows is configured to "hide system files," |
MATLABAddin.dllfile and click Open.
To run the MATLAB add-in for Visual Studio on Windows 98 systems, add this line to your |
For additional information on the MATLAB add-in for Visual Studio:
MATLABAddin.hlpfile in the
Command Line Override
To specify an option on a one-time basis to the
mex script, you can use the
mex command line override feature. For example, the string
/WX is a Microsoft Visual C/C++ compiler option that causes warnings to be treated as errors. The following statement uses the
mex command line override feature.
COMPFLAGS#"$COMPFLAGS /WX" tells
mex to take the default value for
COMPFLAGS and append
/WX (space slash W X) to it. To get a list of all environment variables that can be overridden using this feature, use the command
Any variable name in all uppercase listed in the output can be overridden.
The MATLAB serial port interface provides direct access to peripheral devices such as modems, printers, and scientific instruments that you connect to your computer's serial port. This interface is established through a serial port object, which you create with the
serial function. The serial port object supports functions and properties that allow you to
|Note The serial port interface is supported only for Microsoft Windows, Linux, and Sun Solaris platforms.|
|3-D Visualization Features||Creating Graphical User Interfaces - Features|