Code Generation Order for Initialization code in Simulink

Is there any way to control the code generation order for the initialization function of a model?
For example I have an initialization block, BLOCK A, and an s-function BLOCK B, which has some initialization code. I want to place BLOCK A's initialization code before BLOCK B s-function's Start code. Is it possible to control this code generation order?
I tried using the priority option for subsystems, but that did not work.

回答 (1 件)

Benjamin Thompson
Benjamin Thompson 2022 年 2 月 8 日

0 投票

You could put the initialization code for one or both blocks in a System Initialize Custom Code block. If you know Blocks A and B are always going to be used together in a model, move the initialization code from one to another so it is in the correct sequence, or just combine them into a single Block AB.

カテゴリ

ヘルプ センター および File ExchangeSimulink Coder についてさらに検索

製品

リリース

R2021b

質問済み:

2022 年 2 月 7 日

回答済み:

2022 年 2 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by