How to execute java program in MATLAB?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I am having MATLAB R2011a Version. I want to execute a java program using MATLAB. For this i have created a java program named as "Hello" and after compiling i converted into class file. Than i opened MATLAB set the class path by using edit classpath.txt. But wen i am executing this code using
o = Hello;
javaMethod('main', o);
it returns ??? Undefined function or variable 'Hello'. what to do?
0 Kommentare
Antworten (1)
David Young
am 29 Jan. 2015
In
o = Hello;
Hello is the name of a variable, as it would be in Java also. (It could also be the name of a function in MATLAB.) When a variable name appears to the right of =, it is evaluated. Since Hello has not been given a value, the attempt to evaluate it fails and you see the error message.
You probably need
o = 'Hello';
The right hand side of this is a string constant, not a variable.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Call Java from MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!