Use struct data from MATLAB workspace in Stateflow

조회 수: 5 (최근 30일)
Cole Pratt
Cole Pratt 2020년 7월 9일
답변: Mark McBroom 2020년 7월 13일
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