How to update counter variable in a for loop
<p>Say I have a for loop that counts from 10 down to 1 with counter <code>k</code>. In the loop, when <code>k</code> becomes 5, I make <code>k=4</code>. When I output <code>k</code> in each loop, I expected it would skip the 4 like so:</p>

<pre><code>10 9 8 7 6 5 3 2 1
</code></pre>

<p>Instead I got all the numbers from 10 down to 1, it did not skip the 4. How can I make it so that it skips 4?</p>

<pre><code>for k=10:-1:1
   if i==5
      k=i-1;
   end
end
</code></pre>