For Loops which do not use an iterator Variable in the action:
In all the illustrations that we seen so far, the value of the loop variable has been used in same way in the action of the for loop:
We have printed the value of i, or added it to a sum, or multiplied it by the running product, or used it as an index into the vector. It is not always essential to really use the value of the loop variable, though. At times the variable is easily used to iterate, or repeat a statement at specified number of times. For e.g.,
for i = 1:3
fprintf('I will not chew gum\n')
Generates the output:
I will not chew gum
The variable i is compulsory to repeat the action three times, even though the value of i is not used in the action of the loop.