How do I search a Simulink model for a string in all element properties?
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Monika Jaskolka
le 7 Sep 2021
Modifié(e) : Monika Jaskolka
le 3 Oct 2021
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/731404/image.png)
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, ...)
0 commentaires
Réponse acceptée
stozaki
le 9 Sep 2021
Hi,
Are you effective the following command?
s = 'SearchString';
sys = gcs;
ret = unique(find_system(sys,'BlockDialogParams',s));
1 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!