Why do I get the error: "Cannot change parameter while simulation is running" when running my Simulink model in "Monitor and Tune" mode on external hardware?

32 views (last 30 days)
I cannot change any of my model parameters when I run my Simulink model in External Mode ("Monitor and Tune") with supported hardware, like TI C2000 or STM32 boards. When I try to change a parameter on my Simulink model, I face this error:
"Cannot change parameter 'Constant value: (Value)' of 'ePWM_LED/Constant' while simulation is running".
What can I do to be able to tune parameters without stopping the simulation?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 19 Aug 2025
The “Default Parameter Behavior” is currently set to "Inlined" in the model configuration, whereas it needs to be set to “Tunable” to change parameter values during run-time.  You can find this setting by referring to "Configuration Parameters" -> "Code Generation" -> "Optimization" -> "Default parameter behavior". Please see the image below. 
With the setting configured to: 
  • “Inlined”: The values cannot be changed during run-time. This setting generates optimized code wherein the values of the corresponding blocks parameters are inlined to reduce RAM usage. 
  • “Tunable”: The values can be changed during run-time. This setting generates code with the values of the corresponding block parameters set as tunable fields of a global parameters structure. 
For more info on the setting, please refer to the doc page: 

More Answers (0)

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!