MATLAB: More efficient way of setting condition on for loop

breakefficientforifiterateloop

I have a simple code that consists of an iterating for loop. I have a nested for loop inside of that which iterates j behind the first loop iterating i. To make this happen, I have an if loop inside the nested for loop that breaks if the second iterator is the same as the first iterator, so it looks something like this:
for j = 1:i
if j == i
break
end
% code
end
I feel like this is not the most efficient way of doing this, so I was looking for some tips. Thanks.

Best Answer

for j = 1:i-1
% code
end