How do I provide input to a Simulink model without placing it in the workspace

前端 未结 4 1578
小鲜肉
小鲜肉 2020-12-29 12:38

I have a Simulink model that is currently being run from a script (i.e. not a function). The script writes variable values to the MATLAB workspace, runs the model simulation

4条回答
  •  一向
    一向 (楼主)
    2020-12-29 13:26

    You can use the evalin() function to execute from your own function a MATLAB expression (as a string) in a specific workspace, in your case the 'base' for SIMULINK to find them. However, if you do not want to use the workspace directly then you can load and save the signals or variables from/to MAT files using the From/To File blocks.

提交回复
热议问题