MATLAB: Explain this while loop

doit4mehomeworkwhile loop

Please explain the steps to how this code fragment works. I don't really understand count or index. Thanks.
What is count as a result of the given Matlab code fragment? Showing your work
may result in partial credit.
numbers = [2 4 3 -5 1 0];
count = 0;
index = 1;
while numbers(index) > 0
count = count + 1;
index = index +1;
end
count = 3

Best Answer

numbers(1)=2
numbers(2)=4
numbers(3)=3
numbers(4)=-5 % before numbers becomes <0 the counter=3