How to export simulink data to workspace during simulation?

后端 未结 3 1338
再見小時候
再見小時候 2021-01-05 03:47

I want to retrieve the data from simulink during simulation, and use serial network function to send these data to another program. Because I need to use an

3条回答
  •  遥遥无期
    2021-01-05 04:09

    At any time during simulation you can force Simulink to write the simulation output data to the workspace:

    set_param(bdroot,'SimulationCommand','WriteDataLogs');
    

    I've found that this command is quite unstable in my Matlab 2010a for Win64. In particular I have to avoid it when simulation is stopped (i.e. first check get_param(bdroot,'SimulationStatus') ), otherwise Matlab shows an error and asks to be restarted.

提交回复
热议问题