Matlab For Loop Ranges & Steps

February 04, 2019

We all love the confusing Matlab syntax! It definitely takes some time getting used to. If you're working with loops, the 2 snippets below can really help you out.

Range of values in a Matlab for loop:

for i = 1:10
   % statements
end

Step Increments of -1:

for i = 10:-1:0
   % statements
end