Is it Possible to store an if Condition in a String to manipulate later ?
1 次查看(过去 30 天)
显示 更早的评论
采纳的回答
更多回答(1 个)
Guillaume
2014-10-22
编辑:Guillaume
2014-10-22
If you really want to store your condition in a string, then use eval as Orion said. However, I wouldn't do that as you don't get an syntax check for the code in your string.
aaa = @(x) x>0 && x<5; %anonymous function, the name of the variable doesn't matter
if aaa(r) r=r+1;
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!