how to store the values in a matrix every time within an infinite while loop
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
hamza karim
2021-10-26
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
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!