MATLAB: For loop

for loop

in for loop, what is the best way to skip some values of the index variable? for i=1:10;
do something;
end
but skip i=4,6,9

Best Answer

for i = setdiff(1:10, [4,6,9])