How do I search a Simulink model for a string in all element properties?

37 ビュー (過去 30 日間)
Monika Jaskolka
Monika Jaskolka 2021 年 9 月 7 日
編集済み: Monika Jaskolka 2021 年 10 月 3 日
I want to programmatically search for a string in a model such that the results match the usual GUI Finder (Ctrl+F), that is, it returns all instances of that string used in any property. For the example below, SearchString is used in multiple properties (Name, DataStoreName, Value). When I search, all of those are in the results. How do I do this with find_system? It seems like I would have to do this for each property, which is not really feasible considering all the possibilities and the fact that there could be custom properties made by the user.
s = 'SearchString';
sys = gcs;
a = find_system(sys, 'Name', s);
b = find_system(sys, 'DataStoreName', s);
c = find_system(sys, 'Value', s);
d = find_system(sys, 'GotoTag', s;)
...
allInstances = vertcat(a, b, c, d, ...)

採用された回答

stozaki
stozaki 2021 年 9 月 9 日
Hi,
Are you effective the following command?
s = 'SearchString';
sys = gcs;
ret = unique(find_system(sys,'BlockDialogParams',s));
  1 件のコメント
Monika Jaskolka
Monika Jaskolka 2021 年 9 月 9 日
編集済み: Monika Jaskolka 2021 年 10 月 3 日
Thanks! This is what I was looking for.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by