Rapid Accelerator and sldrt.tlc compile issue: Code Generation and simulation targets registered different sets of persistent variables for the block.

15 views (last 30 days)
When I run my code with normal or accelerator mode or compile using grt.tlc my model executes succesfully. If I attempt to use rapid accelerator or sldrt.tlc, I receive this error:
Code generation and simulation targets registered different sets of persistent variables for the block. External or Rapid Accelerator mode simulation requires code generation and simulation targets to register the same set of persistent variables for this block. This discrepancy is typically caused by MATLAB functions that have different code paths for simulation and code generation targets where these code paths define different sets of persistent variables. Please identify these code paths in the offending block and rewrite the MATLAB code so that the set of persistent variables is the same between simulation and code generation.
This model is based almost entirely around stateflow and simply imports data from a binary file reader.
Things I've tried:
  1. Completely removed persistent variables from called matlab functions
  2. Followed this heirarchy for compiling matlab functions, made everything a subfunction, and then removed all extra files from the folder location. https://www.mathworks.com/help/coder/ug/how-matlab-resolves-function-calls-in-generated-code.html
  3. Tried various other compiling targets. Embedded coder returns a sizing error that I don't intend to fix currently.grt.tlc works great.
I can't find any information on the 2 seperate paths the error is referring to so I would be interested in knowing if that's a setting somewhere.

Answers (1)

Pablo Romero
Pablo Romero on 31 May 2022
Please check out the following bug report.


Find more on Simulink Coder in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!