Compile Parametrized Simulink model name
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Steve Oswald
le 4 Nov 2021
Réponse apportée : Fangjun Jiang
le 9 Nov 2021
Hello,
I'd like to compile a parametrized model name by variable. e.g.:
modelname = get_param(bdroot, 'Name');
modelname([],[],[],'compile');
When I execute the code, I get:
>Index in position 4 exceeds array bounds (must not exceed 1).
I expected it to compile the model. Since modename = "TheModel", when I execute the following code:
TheModel([],[],[],'compile')
The model compiles successfully, however, I cannot parametrize the name of the model. I want to clarify:
I need to compile a model, which's name I have only stored in a variable.
Thank you in advance!
Kind regards,
Steve
0 commentaires
Réponse acceptée
Fangjun Jiang
le 9 Nov 2021
In this case, you might have to use eval()
MyCommand=[modelname,'([],[],[],''compile'')'];
eval(MyCommand);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!