Command Sequence Controls
Counter Variable
Often, loops involve a count or a counter variable that is updated each time the code within a certain condition is executed.
Exercise: Counter variable > Type in the following code and verify the result. |
Tip: Clear the Command Window by going to Edit>Clear Command Window. |
% determine the number of elements in allNumbers bigger % than 100 count = 0 % initialize count allNumbers = 200*rand(1,10); % array of random numbers for index = 1:1:10 end |