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!