フィルターのクリア

How can I avoid function duplication in code generation?

2 ビュー (過去 30 日間)
yeyuan zhu
yeyuan zhu 2023 年 3 月 22 日
コメント済み: yeyuan zhu 2023 年 5 月 23 日
I wrote a corresponding .c and .tlc file for code generation to a Simulink s-function module. However, I found that as I have used the module several times in simulink, the instructions written in the start(block,system) output of the tlc file are repeated in the initialization function of the model.c for code generation. How can I adjust it so that these instructions appear only once?

回答 (1 件)

Mark McBroom
Mark McBroom 2023 年 3 月 25 日
You need to move your code from the Start() TLC function to the BlockTypeSetup() TLC function. The BlockTypeSetup() TLC function is only called once no matter how many times the S-Function block is used in the model. See here for exxample:

カテゴリ

Help Center および File ExchangeTarget Language Compiler についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by