Create Variant object based on Configuration Reference

D
Donn_shull · Sep 22, 2021 · 2.1K views
Question
Hi all   I have a structure of models and model references, which all use the very same Configuration Reference object as their Configuration Parameters set. By changing the Configuration Reference, I can change the Configuration Parameters for all models at once. This Configuration Reference object and those Configuration Parameter sets are located inside a Data Dictionary, to which all models have access to.   I am using Variant Subsystems inside my models, and I want to make those variants based on which selection I make in the Configuration Reference object. (To which Configuration Parameter set I am pointing it to basically.) So I wanted to create a Simulink.Variant object, and as a condition I want to make a check of the Configuration Reference. For example, I want to see if the 'SystemTargetFile' is equal to 'ert.tlc'.   The problem I am having is how to write an expression for the Simulink.Variant object to get info from the Configuration Reference object?   I have used the following expression succesfully before:   strcmp('ert.tlc',get_param('mymodel','SystemTargetFile')) but it requires to provide the model name as an argument. Since I need to use this Simulink.Variant object for all my models, I cannot provide the model name since it will be different many times.   I have tried the following expression:   strcmp('ert.tlc',get_param(Configuration_set,'SystemTargetFile')) but it cannot find the Configuration Reference object called 'Configuration_set', although the Variant object and the Configuration Reference object are inside the same Data Dictionary.  
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Aug 24, 2026
Your variant expression cannot find your configuration object because variant object and the configuration object are in different Dictionary sections.
 
You could trysomething messy like storing a string with the name of your data dictionary in the 'Design Data' section:
 
thisDataDictionary = 'MyDataDictionary.sldd'
Then use an expression like
 
strcmp('grt.tlc', get_param(Simulink.data.dictionary.open(thidDataDictionary).getSection('Configurations').getEntry('Configuration_set').getValue, 'SystemTargetFile'))
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!