Use struct data from MATLAB workspace in Stateflow

5 次查看(过去 30 天)
I have a struct in the MATLAB workspace with some values and some arrays stored in it. I need to access some of the values from this struct in a Stateflow block in Simulink. What is the best way to be able to access these values?
My struct name is 'A' and I want to access the value 'b'. In Stateflow, I tried just referencing 'A.b' as I would in MATLAB, and it does not work.
I have seen that using a bus might be possible, but I cannot find a way to convert a struct to a bus and then use that bus as an input to the Stateflow.

采纳的回答

Mark McBroom
Mark McBroom 2020-7-11
In Stateflow, define your struct A as a Parameter. See attached example.
  1 个评论
Cole Pratt
Cole Pratt 2020-7-13
Thanks for the help. I don't have access to MATLAB 2020a. Is there any way you can save this in a 2019b readable format?

请先登录,再进行评论。

更多回答(1 个)

Mark McBroom
Mark McBroom 2020-7-13
Added 19b version.

类别

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

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by