A way to make the Simulink program run and then perform the calculation
3 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Jon
2023-5-19
You can set the model's StopFcn call back for this purpose.
Go to the Modeling tab, model settings, properties,callbacks, and assign your stop function there.
Provide the name of the script or function to be executed in the StopFcn callback property.
Note the script must use values that are assigned in the workspace, so you should provide some to workspace blocks or use other means (assign data logging) to the outputs of interest so they will be in the workspace after the simulation stops.
2 个评论
Jon
2023-5-24
Sorry I'm not completely clear on what you are trying to do and what problem you are having.
With the StopFcn, shown above, the new value for the variable, Angle, will be assigned in you base workspace after the run is completed. If you run the model again, the new value will be used. If you need to initialize the variable, Angle, for the first time you open and run the model you could do that in a script that you run before running the model. This could also be put into a model Callback function, such as InitFcn
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Model, Block, and Port Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!