External Interfaces Reference Previous page   Next Page
javaMethod

Invoke Java method

Syntax

Description

javaMethod('method_name','class_name',x1,...,xn) invokes the static method method_name in the class class_name, with the argument list that matches x1,...,xn.

javaMethod('method_name',J,x1,...,xn) invokes the nonstatic method method_name on the object J, with the argument list that matches x1,...,xn.

Remarks

Using the javaMethod function enables you to

The javaMethod function enables you to use methods having names longer than 31 characters. This is the only way you can invoke such a method in MATLAB. For example:

With javaMethod, you can also specify the method to be invoked at run-time. In this situation, your code calls javaMethod with a string variable in place of the method name argument. When you use javaMethod to invoke a static method, you can also use a string variable in place of the class name argument.

Examples

To invoke the static Java method isNaN on class, java.lang.Double, use

The following example invokes the nonstatic method setTitle, where frameObj is a java.awt.Frame object.

See Also
javaArray, javaObject, import, methods, isjava


Previous page  javaclasspath javaObject Next page

© 1994-2005 The MathWorks, Inc.