Case statements

2 visualizaciones (últimos 30 días)
Natasha
Natasha el 24 de En. de 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!

Respuesta aceptada

Walter Roberson
Walter Roberson el 24 de En. de 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 comentario
Jan
Jan el 25 de En. de 2012
See "help switch" and "doc switch".

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by