ENGR 121 Lecture Notes - Lecture 7: Matrix Multiplication, Matlab, Infinite Loop

49 views6 pages

Document Summary

Input in a for loop: can be used to repeat the process of promping the user and reading input a speciied number of imes for i = 1:n. % do something with the value end: the values entered can be stored into a vector it is best to irst preallocate the vector to have the correct number of elements. Combining for loops and if statements: the acion of a for loop can include an if statement, the acion of an if statement can include a for loop. Used if an acion is required on an element only if a condiion is met. Use ctrl + c to break out of an ininite loop. Couning in a while loop: it can be useful to count how many imes the acion of the loop has been repeated, general form of a while loop that counts counter = 0; while condiion. % acion counter = counter + 1; end.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents