Returning output signals from a Simulink block to Matlab

4 次查看(过去 30 天)
I have a Simulink Block with 9 output signals which can either be 0 or 1 (true or false). Each output signal is connected to an OutBus. I want to be able to get the values for each of the signals in Matlab so I can assign them to variables and use them elsewhere. I need to be able to do this while the simulation is running, which is where I am having trouble. Any help would be appreciated.
  3 个评论
Fangjun Jiang
Fangjun Jiang 2023-3-6
Usually, it is difficult to access Simulink signals when the simulation is running. That is why @Paul asks for further clarification. You could do that processing using a MATLAB Function block and add it to the Simulink model.
Luke Chapman
Luke Chapman 2023-3-6
The matlab simulation is being run from Enterprise architect, the inputs to the system are set using constant blocks and the set_param function is used to set the constant values. I need to get the outputs of the system which are in the form of logical signals. I was looking to be able to run a piece of code which would capture the current value of the signals (0 or 1) and set them to a variable stored in the workspace. I can do this currently using to workspace blocks or by logging the signals but it only works when the simulation is paused or stopped (i.e the variable does not update while the simulation is running) this unfortunately is not good enough for what I need to do.

请先登录,再进行评论。

采纳的回答

Fangjun Jiang
Fangjun Jiang 2023-3-6
  5 个评论
Fangjun Jiang
Fangjun Jiang 2023-3-10
The doc says "Your callback function can be specific to a single signal, or you can use the same callback to process and visualize multiple signals. The callback function only has access to data for a single signal at a time. "

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by