Main Content

地图功能JavaClass Methods

地图功能JavaClasses with the Library Compiler App

The Library Compiler app presents a visual class mapper for mapping MATLAB®functions to Java®classes. The class mapper is located between theApplication Informationand theAdditional Installer Optionssections of the app.

TheNamespacefield at the top of the class browser specifies the name of the application into which the generated classes are placed. By default, the name of the first listed MATLAB file is used as the application name. You can change the application name to fit the naming conventions used by your organization.

The table used to match functions to classes is below the application name. TheClass Namecolumn specifies the name of the generated Java class. TheMethod Namecolumn specifies the list of MATLAB functions that are mapped into methods of the generated class.

Add a New Class to aJavaApplication

To add a class to a Java application:

  1. ClickAdd Class.

  2. Rename the class as described inRename a Java Class.

  3. Add one or more methods to the class as described inAdd a Method to a Java Class.

Rename aJavaClass

To rename a Java class:

  1. Select the name of the class to be renamed.

  2. Open the context menu.

  3. SelectRename.

  4. Enter the new class name.

    The class name must follow the Java naming guidelines. It cannot contain any special characters, dots, or spaces.

删除a Class from aJavaApplication

To delete a class from a Java application:

  1. Select the name of the class to be deleted.

  2. Open the context menu.

  3. Select删除.

Add a Method to aJavaClass

To add a method to a Java class:

  1. In theMethod Namecolumn of the row for the class to which the method is being added, click the plus button.

  2. Select the name of the function to add.

删除a Method from aJavaClass

To delete a method from a Java class:

  1. Select the name of the function to be deleted.

  2. Open the context menu.

  3. Select删除.

Tip

You can also delete the method using the删除key.

地图功能JavaClasses withmcc

When usingmccto generate Java applications, you map your MATLAB functions into Java classes based on the list into which they are placed on the command line. Class groupings are specified by adding one or moreclass{className:mfilename...}entries to the command line. All of the files not included in a class grouping are added to the class specified by the-W java:packageName,classNameflag.

For example,mcc —W java:myPackage,MyClass fun1.m fun2.m fun3.mgenerates a Java applicationmyPackagethat contains a single classMyClass.MyClasshas three methods:fun1,fun2, andfun3.

However,mcc —W java:myPackage,MyClass fun1.m fun2.m class{MyOtherClass:fun3.m}generates a Java applicationmyPackagethat contains two classes:MyClassandMyOtherClass.MyClasshas two methods:fun1andfun2.MyOtherClasshas one methodfun3.