how to create a loop in matlab code example Example: for matlab s = 10; for c = 1:s %some code end %%foreach like for v = [1 5 8 17] disp(v) end