exchange data between blocks using Workspace in Simulink.
2 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I am not experienced with MATLAB and Simulink, so I'm having some trouble to communicate two blocks with each other. I want to produce and update a variable set in a Simulink simulation and use them in the same simulation in different places and I want to achieve that using workspace.
I calculate some variables during simulation (using Interpreted MATLAB Function) and I export them to the workspace with 'To Workspace' block. But I can't get the variables as I want with 'From Workspace' block (Actually I couldn't even manage to run the simulation when using FromWorkspace block, due to 'Invalid variable specification' error etc.) I tried timeseries, Array, Struct. I am missing something but I can not find it.
For example, I use 'Interpreted MATLAB Function' and calculate 2 variables during simulation continuously. And in the same simulation I want to use the first variable as an input for the block A and the second variable as an input for the block B. This is a simplified example, I would have 30-40 variables in my simulation, thats why I don't just connect outputs to the inputs directly. I have to communicate those blocks over variables.
How can I use those two blocks ('To Workspace' and 'From Workspace') to select the data (which can change continuously during the simulation) I want with 'From Workspace' block? Or do you have any suggestions to do it in another way?
Thank you in advance,
Berkin,
0 件のコメント
採用された回答
Birdman
2018 年 4 月 14 日
Actually, you can not use From Workspace or To Workspace blocks to exchange data during simulation. They are meant to be used after the simulation. To achieve your goal, you need to use From and Goto tags which are really useful. I can not help you further since I don't have your model, but try to use From and Goto Tags and let me know the results. Check them from the following links:
2 件のコメント
Birdman
2018 年 4 月 15 日
Berkin's answer moved here:
Thank you Birdman, I'll try those two in my simulation and I'll let you know if it's work or not.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Sources についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!