find_system versus Simulink.findVars
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a reasonably large model (~30,000 blocks) I'm trying to automate the changing of variable references in. The goal is to put "this_prefix." in front of variable references for a specific field (i.e. 'Value' for block type "Constant", 'Gain' for block type "Gain", etc.) in order to put all 1800+ Workspace variables into one structure; however, there is a catch. I want to leave blocks that are masked alone but I do want to change the fields in the parent masking block.
If possible, I'd like to look at only those blocks which use a variable in the workspace (hence the Simulink.findVars command) but cannot use the argument " 'LookUnderMasks', 'none' " that is present in find_system command because, as far as I can tell, it doesn't exist.
So far, I can get the "block address" for each block, and get_param works nicely for each one; I just can't figure out how to not have the code completely skip a masking block, or even tell if it's looking at them.
I'm cautious to share any code because it's all proprietary.
Thanks in advance.
-Bo
0 commentaires
Réponse acceptée
Guy Rouleau
le 12 Juil 2013
Simulink.findVars returns a list of simulink.variableusage objects.
This object has a "Source" property telling you where the variable comes form. Using that should allow you to only rename the variables you are looking for.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!