How to search all parameters of all blocks in a model

19 vues (au cours des 30 derniers jours)
Jeremy
Jeremy le 24 Juin 2016
Réponse apportée : Jeremy le 24 Juin 2016
I need my script to find all of the references to a particular data type within a Simulink model. I understand how I could find most of them with "find_system({model}, 'OutDataTypeStr', '{my data type}')", but what if the type is referenced in a field other than OutDataTypeStr, like TableDataTypeStr or IntermediateResultsDataTypeStr? Is there any way to search for a string in all parameters of all blocks in a model? I already tried "find_system({model}, 'RegExp', 'on', '.*', '{my data type})", but the "RegExp" parameter only seems to apply to the data parameters, not the field name parameters.

Réponse acceptée

Jeremy
Jeremy le 24 Juin 2016
I just found an answer to my own question:
"find_system('RegExp', 'on', 'BlockDialogParams', '{my data type}')" finds any Simulink block which contains the name of my data type in any parameter. The output also contains multiple copies of the name of any block with multiple parameters containing my type name, so I can tell how many there are.
It would be nice if I could also get a list which includes the parameter names, but I can find that separately with a loop. At least there is no longer any need to loop through every parameter of every block in my model.

Plus de réponses (0)

Catégories

En savoir plus sur Simulink Functions 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!

Translated by