how to store the values in a matrix every time within an infinite while loop

2 visualizzazioni (ultimi 30 giorni)
reply_timer=5;
t=20;
The infinte loop will run 15 times(t-reply_timer). Everytime when the loop got executed we get some value. How to store all this 15 values updated in a matrix.???? Could anyone suggest me some hints??
while(1)
if(reply_timer<t)
......
........
Value= max(S(:));// some calculation done to find Value
end
end
  2 Commenti
hamza karim
hamza karim il 26 Ott 2021
if the infinite loop will run 15 times, i would understand that at the end you would have a total of 15 values, where each value is a scalar since you write "value=max(S(:)". In this case, i assume your S is a vector of nx1 and then Value is a scalar.
I would simple define value before the while loop as a vector of size 15 and put a counter that woul update after each iteration
Value=zeros(15,1);
counter=1;
while (1)
if(reply_timer<t)
value(counter)=max(S(:));
end
counter=counter+1;
end

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Prodotti


Release

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by