How to search all parameters of all blocks in a model

19 ビュー (過去 30 日間)
Jeremy
Jeremy 2016 年 6 月 24 日
回答済み: Jeremy 2016 年 6 月 24 日
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 Center および File ExchangeSimulink Functions についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by