The other parts are optional you can have multiple

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: al. You can have multiple elseif clauses. After executing the particular case the code jumps to after the end. The otherwise part is optional. 6 The Try/Catch Construct There is a special construct in MATLAB for catching errors try Statement 1 Statement 2 catch Statement 3 Statement 4 end While Loops in MATLAB Very similar to C++: while expression statement 1 statement 2 etc. end The try block is executed. If an error occurs it jumps to the catch block. For Loops in MATLAB ForFor-loops in MATLAB are a bit different than for-loops forin C++ for index = array Statement 1 Statement 2 etc. end index takes the value of each column in the array in turn. For Loops in MATLAB The control expression in a for-loop in forMATLAB can even be an array with more than one dimension. In this case the index takes on the value of an entire column one column at a time. break and continue There are two commands you can insert into a MATLAB loop to alter the flow of control. break will cause the program to im...
View Full Document

This note was uploaded on 05/04/2010 for the course ENGIN 101 taught by Professor Jeffringenberg during the Spring '07 term at University of Michigan.

Ask a homework question - tutors are online