MATLAB: While loop iteration in matlab

MATLABwhile loop

If I am have this code as example
while(A>0.0000001);
statment
.
.
.
end
How can save value of A to each iteration until reach 0.0000001?
I mean there is (A) at first iteration, (A) at second iteration,and so on

Best Answer

K = 1;
A(K) = .... some initial value ...
while( A(K) >0.0000001)
statment
.
.
.
K = K + 1;
A(K) = new value for A
end