This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 14:440:127 Introduction to Computers for Engineers Lecture 5 Lecturer: Blase E. Ur Recitation Instructor: Tianming Li Recitation Instructor: Ke Xu Recitation Instructor: Brian Viezbicke Recitation Instructor: Mingliang Wang PLEASE TAKE LECTURE 5 NOTES AS YOU ENTER THE ROOM Rutgers University SOE 14:440:127 Lecture 5 Reminders / Updates • Answers to everything ever was posted online. • Your first Exam will be some time between this Wednesday and next Tuesday, inclusive. • You guys sent me a lot of email this weekend. • Thank you to everyone who was active on the discussion board and in the lab, helping out other students! Rutgers University SOE 14:440:127 Lecture 5 Exam 1 • DON’T log into your engineering account! We’ll announce a special account for you to use (only Matlab). • All answers are written in blue books • 30 minutes, no computers – 6 questions – Bluebook collected after 30 minutes (possibly extended to 40) • 50 minutes computerized – 4 questions • Reasonably difficult, and different for each recitation Rutgers University SOE 14:440:127 Lecture 5 Loops disp(1) disp(2) disp(3) disp(4) disp(5) disp(6) disp(7) disp(8) disp(9) … Rutgers University SOE 14:440:127 Lecture 5 For Loop for i = 1 : 100 disp(i) end • First time through the loop, i=1 • Then, go back to the top; i=2 • … • The last time through the loop, i=100 Rutgers University SOE 14:440:127 Lecture 5 For Loop Example from Project Find the mins in column 6 of c: loc = find(c(:,6) == min(c(:,6))); for i = 1:length(loc) fprintf('Gene %s has %.0f \n', d{loc(i),1}, c(loc(i),6)) end % loc is now a vector of locations % repeat for each element of loc % loc(i) is now each row number, in succession Rutgers University SOE 14:440:127 Lecture 5 For Loop Vs. While Loop • FOR Know exactly how many times to execute the code • WHILE Execute while some condition is true • FOR Will stop • WHILE May never stop (Infinite Loop) – What do you do if this happens? CTRLC • FOR and WHILE May never start Rutgers University SOE 14:440:127 Lecture 5 While while( condition ) statements end 1+2+…+n, what is the smallest n for which the sum is 3 digits?1+2+…+n, what is the smallest n for which the sum is 3 digits?...
View
Full Document
 Fall '09
 blase
 Rutgers University SOE

Click to edit the document details