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

前端 未结 4 1582
小鲜肉
小鲜肉 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:30

    Short answer: No.

    I could be wrong, but let me give you some background. I work on a Simulink model that is very large, we have been working on it for years. To this day we still load all necessary variables in through the workspace. This has been a complaint of mine for a long time, so much that MathWorks has even addressed the issue by providing the Simulink.save_vars function. It sounds like you are already setting up variables with a script/function, so Simulink.save_vars won't be much use to you.

    You can clean up the workspace by using structures for some of the variables, most Simulink blocks don't support structures, but some do. Also, avoid putting anything in the workspace other than variables that your model needs.

提交回复
热议问题