How to pass a changing value from workspaces to Simulink?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Ameer Hamza
2020-5-28
How is value changing in base workspace? Are you running a loop which changes the value of the variable?
采纳的回答
Ameer Hamza
2020-5-28
编辑:Ameer Hamza
2020-5-28
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 个评论
zahra hosaini
2021-9-7
OMG
this actualy works!
i have been looking for a week
thank you very much for the answer
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!