stateflow和simulink block的联动问题

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

Respuestas (1)

Aditya Saikumar
Aditya Saikumar el 29 de Ag. de 2024
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!

Categorías

Más información sobre Big Data Processing en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!