Case statements

2 views (last 30 days)
Natasha
Natasha on 24 Jan 2012
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!

Accepted Answer

Walter Roberson
Walter Roberson on 24 Jan 2012
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 Comment
Jan
Jan on 25 Jan 2012
See "help switch" and "doc switch".

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!