Using For Each subsystem block for time slicing algorithm execution repetitions

1 回表示 (過去 30 日間)
Rishab Anand
Rishab Anand 2022 年 5 月 23 日
回答済み: Akash 2023 年 12 月 18 日
I am using a For Each subsystem to repeat algorithm execution on four set of sensor readings in a single time step. The algorithm has some unit delay blocks. I use my model to generate C code. The generated code has four sets of storage variables corresponding to the unit delay blocks. I now want to spread out those four repeatitions in four consequtive time steps. Is it possible to continue using the for each subsystem block and achieve this ?
If not, what is the best way to do this ?

採用された回答

Akash
Akash 2023 年 12 月 18 日
Hi Rishab,
I understand that you are looking to modify the behavior of your "For Each subsystem" in Simulink, so that instead of processing all four sets of sensor readings in a single time step, you want to spread the execution over four consecutive time steps while generating C code.
To achieve this, you can use "Conditionally Executed Subsystems". This approach allows you to control the execution of a subsystem based on an external signal. By utilizing a "control block" within your model, such as an "If" or "Switch" block, you can create logic that determines which set of sensor readings to process in each time step.
For more information on how to implement and configure Conditionally Executed Subsystems, you can refer to the below mentioned link:-
I hope it helps,
Thanks and Regards,
Akash.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSchedule Model Components についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by