find_system versus Simulink.findVars
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuesta aceptada
Guy Rouleau
el 12 de Jul. de 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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Programmatic Model Editing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!