ENGRMAE 10 Lecture Notes - Lecture 6: Hayes Command Set, United States Equestrian Federation, Iterator

17 views4 pages

Document Summary

Loops are useful when you want a certain set of commands executed over and over and over and over and . There are two types of loops in matlab/octave: (a) for loops and (b) while loops. (a) for loops: For loops are useful when you know you need to perform a task a certain amount of times. for index = a:c:b commands end. The index variable will take on all the values in the array a:c:b as it goes through the loop. The first value of index will be a. Often, it is useful to think of a, c, and b in the following terms, for index = initial value : increment : end value commands end. Let"s say the a is 1, c is 2, b is 5. 1:2:7 yields an array of 1 3 5 7. When the for loop begins, the first value of index will be the first array element, 1.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions