Simulink 'To Workspace' Block variable change in a Matlab script
2 ビュー (過去 30 日間)
古いコメントを表示
Hello, I have a Simulink model that is dependent on a parameter. Now I would like to change this parameter in a "loop function" and record a new data series in the workspace for each run. The problem is in the "to Workspace" block I cannot overwrite the variable via matlab script. Is there a command for this or another way of how I record data series to which a variable is assigned during the "loop function"?
Thank you in advance, Jan
0 件のコメント
回答 (1 件)
Rhea Chandy
2021 年 3 月 4 日
Hi Jan,
From what I understand, you need to find a way to change a variable parameter in a simulink model programmatically, but you're not able to overwrite the variable.
It may be that when you use the "To Workspace" block, the variable parameter is being saved into the model workspace rather than in the base workspace. This may be the reason you're not able to overwrite the variable via matlab script. More data about working with Model Workpaces is here: Model Workspaces
Another reason could be that If you are using the sim MATLAB function, the To Workspace block sends data to the workspace of the calling function, not to the MATLAB base workspace. The base workspace stores variables that are written at the command line. More info on the difference between the workspaces and how to share data between the workspaces, can be found here : Base and Function Workspaces
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!