Alternatives to 'For Each subsystem' that are compatible with global data outside the subsystem

2 ビュー (過去 30 日間)
Jie
Jie 2024 年 7 月 9 日
コメント済み: Jie 2024 年 7 月 9 日
Hello all,
For a project, I am making use of the For Each subsystem in my Simulink model. I have a set of values for one of the input variables of the block and the goal is to have Simulink generate a set of outputs for each input value. The number of input and output will be different with configurations "N". The For Each subsystem works great for this purpose, but unfortunately the Coder cannot convert it to C code. How could I make use an N as exportgloabl with For Each subsystem?

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2024 年 7 月 9 日
The number of input and output will be different with configurations "N"
In that case, the value of "N" is determined by the partition and the size of the input. It is not something that is pre-set by the user.
I would do it reversely. Define a Simulink.Parameter "M" that is exported global or #define, then construct your input and the partition accordingly to reslut in the value of "N". Hopefully you will be able to generate C code with "M" as a parameter, which is equivalant as "N" being a parameter.
FYI, For Each Subsystem does not support variable-size signals.
  1 件のコメント
Jie
Jie 2024 年 7 月 9 日
I tried this method to define the input and output with "N" as exported global, but it showing it is not supported for for each function.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by