How to prevent simulink from generating code containing erroneous unused variables?
Show older comments
Simulink is generating an unused variable in the model init code for models that include a foreach loop. This is causing issues when we link using gcc, as we don't want any warnings for our compiled product. I'm not sure if we're defining the foreach logic incorrectly or if there is a setting we could tweak to fix this issue.
Has this issue been seen before and is there any known solutions for it?
variable is of the form:
int32_T ForEach_itr;
1 Comment
Noufal Thangal
on 3 Nov 2026 at 18:51
Inside the for-each subsystem add Signal conversion block at inports. This will avoid Matlab from generating unnecessary intialization of for-each variables.
Answers (0)
Categories
Find more on Data Types in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!