Is it Possible to store an if Condition in a String to manipulate later ?
4 ビュー (過去 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 で Dates and Time についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!