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 Center および File ExchangeBig Data Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!