stateflow和simulink block的联动问题

조회 수: 1 (최근 30일)
shi
shi 2024년 8월 8일
답변: Aditya Saikumar 2024년 8월 29일
我需要在stateflow内使用到比如Discrete-Time block模块,并在当前状态循环周期内继续执行后面语句,由于我的targetlink无法使用simulink function,所以我的思路是通过function call的形式,如下图:
那么function-call的out我该如何处理呢?在function完成后,我需要回到状态机内并立即执行后面的指令,并且后续的指令会使用到function-call处理的数据
望能提供支持,谢谢。

답변 (1개)

Aditya Saikumar
Aditya Saikumar 2024년 8월 29일
Hi shi,
I see that you want to call the "function()" in a state. In other words, "Out1" of the "function()" should be usable in a state.
To achieve this, "Out1" can simply be passed as an input to the "Chart". This makes sure that at every time step, "function()" runs and "Out1" is available in all states.
Consider the following example:
In this “Chart”, assume that the “constant” block is the “Out1” of “function()”. In the state, simply use the “data” which is the input signal as follows:
Following is the output when it is run:
Hope this helps!

카테고리

Help CenterFile Exchange에서 复杂逻辑에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!