How to search all parameters of all blocks in a model

17 visualizaciones (últimos 30 días)
Jeremy
Jeremy el 24 de Jun. de 2016
Respondida: Jeremy el 24 de Jun. de 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.

Respuesta aceptada

Jeremy
Jeremy el 24 de Jun. de 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.

Más respuestas (0)

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by