MATLAB: How to obtain the parameter structure when using model references with the Rsim target in Simulink 7.4 (R2009b)

modelreferencersimrsim-targetrsimgetrtpsimulinkstructure

I am using Rsim target to simulate my model in Simulink 7.4 (R2009b). In the model I am using model references and I want to obtain the parameter structure with this command:
rsimgetrtp('main_model','AddTunableParamInfo','on')
But this only returns an empty structure.

Best Answer

Attached to this solution you will find a small demo model which demonstrates how to obtain the parameter structure from a model which uses model references with the following command:
>>rsimgetrtp('main_model','AddTunableParamInfo','on')
Which will return A and K in the struct:
You will get this output:
ans =
modelChecksum: [809202561 3.2719e+009 3.4891e+009 1.8594e+009]
parameters: [1x2 struct]
Please follow these steps to obtain the parameter structure:
1) Define A and K as Simulink.Parameter and set the storage class to SimulinkGlobal
2) Define K as argument for the model reference:
right-click on the model reference --> Model reference parameters --> Model argument value: K
3) Inline parameters: Configuration Parameters --> Optimization --> Inline Parameters
4) Now run rsimgetrtp('main_model','AddTunableParamInfo','on') from the MATLAB command line