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

2 views (last 30 days)
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 Comments
hamza karim
hamza karim on 26 Oct 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

Sign in to comment.

Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!