Is there an error in the documentation for External Interfaces in MATLAB 7.0 (R14) with how MATLAB handles undefined methods?

2 次查看(过去 30 天)
I have a created a file foo.m on my MATLAB path. The contents of the file are below.
function foo(a)
disp(a)
When I execute the following command
ja=java.lang.String('aaa');
ja.foo
I receive the following result
a =
aaa
The documentation states that MATLAB looks for built-in functions when a MATLAB command invokes a nonexistent method on a Java object.

采纳的回答

MathWorks Support Team
This change has been incorporated into the documentation in Release 14 Service Pack 3 (R14SP3). For previous releases, read below for any additional information:
This is an error within the documentation for MATLAB within the External Interfaces section. The documentation should read as follows:
If your MATLAB command invokes a nonexistent method on a Java object, MATLAB looks for a function with the same name. If MATLAB finds a function of that name, it attempts to invoke it. If MATLAB does not find a function with that name, it displays a message stating that it cannot find a method by that name for the class.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Call Java from MATLAB 的更多信息

标签

尚未输入任何标签。

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by