Check out example codes for "for matlab". It will help you in understanding the concepts better.
Code Example 1
s = 10;
for c = 1:s
%some code
end
%%foreach like
for v = [1 5 8 17]
disp(v)
end
Code Example 2
for v = 0.0:+0.2:1.0
disp(v)
end
% Console Output:
% 0
% 0.2
% 0.4
% 0.6
% 0.8
% 1
Learn ReactJs, React Native from akashmittal.com