MATLAB: How to save a number from the loop but only from for iterations?(If the loop runs through currently 4 times i want to subtract the 4th-previous(3rd) integer

loopvector

y=1
while app>emax
app=x+y
storage=app

Best Answer

storage = nan(1,4);
y = 1
while app > emax
app = x + y;
storage = [storage(2:4), app];
end
Related Question