Effacer les filtres
Effacer les filtres

How to pass a changing value from workspaces to Simulink?

1 vue (au cours des 30 derniers jours)
Andrea Strappato
Andrea Strappato le 27 Mai 2020
Commenté : zahra hosaini le 7 Sep 2021
Hi everyone,
I'm trying to pass a value from workspaces to Simulink calculated by Matlab step-by-step. This value changes each step, but the Simulink simulation take the first value and keep it costant. I'm using simin block and doesn't refresh data. How can I solve this issue?
  1 commentaire
Ameer Hamza
Ameer Hamza le 28 Mai 2020
How is value changing in base workspace? Are you running a loop which changes the value of the variable?

Connectez-vous pour commenter.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 28 Mai 2020
Modifié(e) : Ameer Hamza le 28 Mai 2020
If the value is continually changing in the base workspace, you need to use MATLAB function block and evalin() to read the updated value at each time-step. See the attached file (saved in R2020a). It reads the value of variable 'x' from base-workspace.
  3 commentaires
Ameer Hamza
Ameer Hamza le 28 Mai 2020
I am glad to be of help!
zahra hosaini
zahra hosaini le 7 Sep 2021
OMG
this actualy works!
i have been looking for a week
thank you very much for the answer

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Simulink Functions 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!

Translated by