Effacer les filtres
Effacer les filtres

Find model references within model references

18 vues (au cours des 30 derniers jours)
Cedric Kotitschke
Cedric Kotitschke le 20 Fév 2023
Modifié(e) : Suraj le 2 Mar 2023
Hello,
I'm trying to find a model reference within a large simulink model which contains multiple model references, often also model references within model references.
Given the name of the model referenced, how do I get the path (within the simulink model) to that model block?
I know the function
[models,blocks] = find_mdlrefs(system)
but it doesn't connect the model name to the model block.
I also tried
modelBlock = find_system(sysName, 'BlockType', 'ModelReference');
but it only returns the highest level model references but not those within other model references.
Can you help me?
thanks!
  1 commentaire
Oguz Kaan Hancioglu
Oguz Kaan Hancioglu le 20 Fév 2023
Find system has several options. Since you said it only returns the highest model references, you can change the SearchDepth of the find_system function.
Also you can change LookUnderMask, Variants properties of the find_system function to find your model. I haven't tried 'FindAll" option but maybe it solves your problem.

Connectez-vous pour commenter.

Réponses (1)

Suraj
Suraj le 2 Mar 2023
Modifié(e) : Suraj le 2 Mar 2023
It is my understanding that you would like to get the path names of a particular model reference in your large Simulink model.
I’d suggest to use the find_mdlrefs() method, which returns all the model reference blocks in the hierarchy. Further, you may iterate through the array to find the required model.
getfullname(), get_param() and getSimulinkBlockHandle() can prove useful for your issue.

Catégories

En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by