how to write a for loop in matlab code example
Example 1: matlab for
for v = 0.0:+0.2:1.0
disp(v)
end
% Console Output:
% 0
% 0.2
% 0.4
% 0.6
% 0.8
% 1
Example 2: for each loop matlab
elements = 6:2:12;
for element = elements
% Do stuff with element
disp(element);
end