MATLAB_Lesson_LoopingMechanisms_Part1
MATLAB_Lesson_LoopingMechanisms_Part1
Mechanisms (Part 1)
Mr. Christopher Winfrey
Fall 2022
What is a Loop?
n = 10;
f = n;
end
Exercise 2 – For Loop
% Note that a percent symbol represents a comment in code, so it won’t be run like code
for x = 1:10 % Loop, where each loop changes the value of x (10 times)
fprintf('value of x: %d\n', x); % Print the value of x for this loop iteration