How can I avoid local temporary (temp_$N$M) variables in generated code from a simulink model?

조회 수: 17 (최근 30일)
Hello everyone, I am using models that were provided to me to auto-generate code. Local temporary variables (temp_$N$M) are not allowed in generated code but they appear in the resulting code, I have tracked them down to conditions in truth tables in the models. I have tried to avoid them by disabling Model Configuration Parameters such as CompOptLevelCompliant, Block Reduction, or Eliminate superfluous local variables (expression folding) but to no avail.
I do not know if there is any optimization parameter that I can disable at truth table level or if there is some specific configuration in the model that prevents those temp_ variables to be generated in the resulting code. Any help or directions are much appreciated.

답변 (1개)

Gokul Karikkat Swamikuttan
Gokul Karikkat Swamikuttan 2019년 5월 7일
Hello,
I have the same issue, Is there a solution or a way to optimize/control the creation of Local temporary variables.
Much Thanks.
  댓글 수: 1
Nick Mazzilli
Nick Mazzilli 2019년 6월 3일
I have ran into similar issues and unfortunately it seems like the embedded coder is inconsitent with when it listens.
Mario it seems like we have ventured down similar paths. I have had luck with changing variables in the code generation optimization tab in configuration parameters. See if checking specify custom optimizations works, then click eliminate superfluous local variables along with checking optimize global data access to none. Then click inline invariant signals in advanced parameters. I found this to work for me.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Manual Performance Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by