How to pass a data dictionary parameters as an argument in a model reference?
11 views (last 30 days)
Show older comments
Hello!
I have a model with four instances of a model reference, each instance store its parameters in a data dictionary.
I want to pass different values to those parameters in each instance, but I cannot set those parameters as an arguments.
How is it possible to set a data dictionary parameters as an argument?
0 Comments
Answers (1)
Fangjun Jiang
on 11 Mar 2021
I don't think there is a direct way to do this currently in R2020a. I suggest you try a workaround.
Specify an argument, which is the name of the data dictionary file, for the model reference. In the PreLoadFcn callback of the model, load the specified data dictionary.
4 Comments
Fangjun Jiang
on 16 Mar 2021
The variables in model workspace can be referenced by name directly in the Simulink model. To access it through script in MATLAB, you need to use API.
In the PostLoadFcn call back, do this
hws = get_param(bdroot, 'modelworkspace')
hws.getVariable('DataDictFileName')
See Also
Categories
Find more on Manage Design Data 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!