how would i make this tricky switch case
이전 댓글 표시
so im making a for loop and inside the for loop i want to have a certain block of code which is either initiated or not. i know i could use a if command but then the computer would have to process that "if" command for how ever many iterations the for loop is. so how would u code the statement below so that a = %{ and b=%} if a certain criteria is asked for?
for i=1:10
a block of code b
end
thanks!!!
댓글 수: 2
Jan
2011년 10월 8일
The question is not clear to me. Can you insert a running example? Valid Matlab syntax is understood by more users than the term "a block of code b".
Fangjun Jiang
2011년 11월 13일
I don't understand the question either!
채택된 답변
추가 답변 (2개)
Harry MacDowel
2011년 10월 8일
help switch
Jan
2011년 10월 8일
0 개 추천
What's wrong with the IF method? It will cost some milliseconds, while writing this question costs a minute.
Perhaps the problem is getting clear, if you post the relevant part of the program and measure the delay caused by the IF, e.g. by inserting the IF twice.
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!