13.01.2015 Views

Chapter 4: Programming with MATLAB - FET

Chapter 4: Programming with MATLAB - FET

Chapter 4: Programming with MATLAB - FET

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The switch Structure<br />

The switch structure provides an alternative to using the if,<br />

elseif, and else commands. Anything programmed using<br />

switch can also be programmed using if structures.<br />

However, for some applications the switch structure is more<br />

readable than code using the if structure.<br />

switch input expression % which can be a scalar or string<br />

case value1<br />

statement group 1<br />

case value2<br />

statement group 2<br />

.<br />

.<br />

.<br />

otherwise<br />

statement group n<br />

end<br />

4-32<br />

Z.R.K

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!