How to input double values in Simulink from Workspace?

淺唱寂寞╮ 提交于 2019-12-12 04:53:37

问题


I need to do a very basic operation of adding two numbers in Simulink. The values are stored as variables in the workspace.

The 'From Workspace' block seems to take either Timeseries or structures as input. I am not sure how to convert the data to do this basic operation.


回答1:


You can use a Constant blocks and use the name of the variable as the value.




回答2:


  • If your "numbers" are parameters - that is they do not vary with time - use Constant blocks.
  • If they are variables or signals- i.e. they are time-dependent - then use the From Workspace blocks, and package the data as described in the documentation (array, timeseries, etc...) so that you have the data + the corresponding time values.

You have to remember that Simulink is for modelling dynamic systems that vary with time, so everything is assumed to be time-dependent. Having said that, you can parameterize any block in Simulink using data (read parameters) from the base workspace, it's picked up automatically by Simulink.

For simple operations on data that is not time-dependent (parameters), you are better off using MATLAB than Simulink.



来源:https://stackoverflow.com/questions/26742660/how-to-input-double-values-in-simulink-from-workspace

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!