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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4-19<br />

The following statements<br />

if logical expression 1<br />

if logical expression 2<br />

statements<br />

end<br />

end<br />

can be replaced <strong>with</strong> the more concise program<br />

if logical expression 1 & logical expression 2<br />

statements<br />

end<br />

The elseif Statement<br />

The general form of the if statement is<br />

if logical expression 1<br />

statement group 1<br />

elseif logical expression 2<br />

statement group 2<br />

else<br />

statement group 3<br />

end<br />

The else and elseif statements may be omitted if not required. However, if<br />

both are used, the else statement must come after the elseif statement to<br />

take care of all conditions that might be unaccounted for.<br />

Z.R.K

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

Saved successfully!

Ooh no, something went wrong!