Case statements

조회 수: 2 (최근 30일)
Natasha
Natasha 2012년 1월 24일
I have a function I'd like to call for one set of data, update the data, re-run the function... etc. I was thinking I'd use a switch statement for this but it looks like matlab only executes one case; any suggestions? Thanks in advance!

채택된 답변

Walter Roberson
Walter Roberson 2012년 1월 24일
Correct, switch() is not a loop; it is a compact if/elseif/elseif/.../end construct . If you want multiple repetitions you need to use a loop, either "while" or "for"
  댓글 수: 1
Jan
Jan 2012년 1월 25일
See "help switch" and "doc switch".

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by