How to search all parameters of all blocks in a model

17 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Jeremy
Jeremy il 24 Giu 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.

Più risposte (0)

Categorie

Scopri di più su Simulink Functions in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by