How to search all parameters of all blocks in a model

18 次查看(过去 30 天)
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.

采纳的回答

Jeremy
Jeremy 2016-6-24
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by