MATLAB: How to retrieve Simulink parameter names from the rtp structure generated by the RSIMGETRTP function in Real-Time Workshop 6.4 (R2006a)

addtunableparaminfonameoptionparameterrsimgetrtprtwsimulink coder

I am generating code with Real-Time Workshop 6.4 (R2006a) for Rapid Simulation Target. I want to tune parameters within the generated executable without rebuilding the code. For that, I use the "rsim" target and retrieve parameter values from my Simulink model using the RSIMGETRTP function.
I can retrieve parameter values from the rtp structure without information about the parameter names corresponding to the values I retrieve. When building code for the "rsim" target, I would like to know how I can map values in the rtp structure to the names of parameters in my Simulink model.

Best Answer

You can retrieve parameter name information from your Simulink model in the structure generated by the RSIMGETRTP function by enabling the following option:
rtp = rsimgetrtp('modelname','AddTunableParamInfo','on')
You must enable "Inline parameters" in the Simulink Configuration Parameters pane, and specify as "Tunable parameters" those whose values you want to change during execution without rebuilding the model.
For more information about this option you can read the documentation at the following location and run the following Real-Time Workshop demo:
web([docroot,'/toolbox/rtw/ref/rsimgetrtp.html'])
rtwdemo_rsim_param_tuning