How to save the value of a variable inside a for loop in the MATLAb workspcae in each iteration (real-time)
9 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have a simple for loop here and I would like to save the value of variable "a" in each iteration at the MATLAb workspcae. Becaseu I need to read that variable from workspcae simoultaneously and use it in Simulink. I do not need that value after completing the for loop (I could save it in a list), I need that value in real-time (once it gets updated) becaseu it will be used in a Simulink file as an input in real-time.
for i=1:10
a=i;
end
0 件のコメント
回答 (2 件)
Souvik Das
2023 年 1 月 31 日
'global' or 'persistent' might satisfy your usecase. Attached below are the documentations for both:
Roya Salehzadeh
2023 年 2 月 9 日
1 件のコメント
KONSTANTINOS
2024 年 6 月 11 日
Hello,
could you provide me some more information about the solution you followed?
thanks in advance
参考
カテゴリ
Help Center および File Exchange で Target Computer Setup についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!