How to save the value of a variable inside a for loop in the MATLAb workspcae in each iteration (real-time)
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
Souvik Das
le 31 Jan 2023
'global' or 'persistent' might satisfy your usecase. Attached below are the documentations for both:
Roya Salehzadeh
le 9 Fév 2023
1 commentaire
KONSTANTINOS
le 11 Juin 2024
Hello,
could you provide me some more information about the solution you followed?
thanks in advance
Voir également
Catégories
En savoir plus sur Target Computer Setup dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!