Rapid Accelerator and sldrt.tlc compile issue: Code Generation and simulation targets registered different sets of persistent variables for the block.
Hello,
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:
Completely removed persistent variables from called matlab functions
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
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.Hello,
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:
Completely removed persistent variables from called matlab functions
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
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. Hello,
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:
Completely removed persistent variables from called matlab functions
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
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. simulink, stateflow, persistent variables, pathing MATLAB Answers — New Questions