Is it Possible to store an if Condition in a String to manipulate later ?
조회 수: 5 (최근 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!