MATLAB: Case statements

switch

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!

Best Answer

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"