Why is the EVAL command not able to execute when I pass a java string with variables in it?
古いコメントを表示
Why is the EVAL command not able to execute when I pass a java string with variables in it?
The following code does not work properly
clear foo
jstr=java.lang.String('foo=3;'); % create java string
eval(jstr) % evaluate foo in this (caller) workspace
who foo
The following code generates an error
foo=3;
jstr=java.lang.String('foo*2');
bar=eval(jstr); % BUG!! foo exists but is not found
??? Undefined function or variable 'foo'.
Error in ==> D:\MATLAB6p1\toolbox\matlab\lang\@opaque\eval.m
On line 18 ==> varargout{1:nargout} = eval(tryVal);
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Call Java from MATLAB についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!