Need help with Java Class in Matlab in windows 10

2 ビュー (過去 30 日間)
JimTal
JimTal 2020 年 6 月 4 日
編集済み: Ajith Krishna Kanduri 2020 年 6 月 19 日
I have studied examples and had success with the java class example "HelloWorld" but have not been able to get the Addnumber example shown to work. This example was located on this site. Based on post I created a java class as shown below.
package numberpack;
public class Addnumber
{
public double add2num( double a1,double a2)
{
return a1+a2;
}
}
I compiled the class and in matlab used:
obj = numberpack.Addnumber
to access the object but get the message: "Unable to resolve the name numberpack.Addnumber."
My path to the class is valid as it is in the file classpath.txt.

回答 (1 件)

Ajith Krishna Kanduri
Ajith Krishna Kanduri 2020 年 6 月 19 日
編集済み: Ajith Krishna Kanduri 2020 年 6 月 19 日
Hi,
Please try using () parenthesis for creating the object.
obj = numberpack.Addnumber()
Please refer to the following discussion thread for the reference
Hope this helps in resolving the issue.

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by