| MATLAB® | ![]() |
javaMethod('MethodName','ClassName',x1,...,xn)
javaMethod('MethodName',J,x1,...,xn)
javaMethod('MethodName','ClassName',x1,...,xn) invokes the static method MethodName in the class ClassName, with the argument list x1,...,xn.
javaMethod('MethodName',J,x1,...,xn) invokes the nonstatic method MethodName on the object J, with the argument list x1,...,xn.
Use the javaMethod function to:
Use methods having names longer than 31 characters.
Specify the method you want to invoke at run-time, for example, as input from an application user.
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 the MATLAB software. For example:
javaMethod('DataDefinitionAndDataManipulationTransactions', T);
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.
Note Typically, you do not need to use javaMethod. Use the default MATLAB syntax for invoking a Java methods instead. Use javaMethod for the cases described above. |
To invoke the static Java method isNaN on class, java.lang.Double, type:
javaMethod('isNaN','java.lang.Double',2.2)
The following example invokes the nonstatic method setMonth, where myDate is a java.util.Date object.
myDate = java.util.Date;
javaMethod('setMonth', myDate, 3);javaArray, javaObject, import, methods, isjava
![]() | javaclasspath | javaObject | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |