eval for string to variable
이전 댓글 표시
I have a GUI with a string as variable and a returned value for it.
var="simulation type"
returned GUI value:
DataEdit.Value = 1x1 cell array {'RUN 1'}
eval([var '=' char(DataEdit.Value) ';']) gives Error using eval, Argument must be a text scalar.
Any suggestions?
댓글 수: 2
Stephen23
2023년 10월 17일
"Any suggestions?"
The fact that EVAL lets you obfuscate such buggy code should be a big hint that this should be avoided.
Walter Roberson
2023년 10월 17일
And when the XML file has in it
app = ''
then should your code delete your GUI, writing over the app variable that is holding the framework of your entire GUI ?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!