How to access to simulink finder using Matlab Script ?
Afficher commentaires plus anciens
I want to pass a string text to Simulink Finder to look it up in the model (include stateflow) and then if it exists highlight it, how can I do this using Matlab Code?

Réponses (1)
Altaïr
le 14 Oct 2024
0 votes
The ‘find_system’ function in the Programmatic Model Editing enables to search for blocks, subsystems and signals by name. Similarly, the ‘find’ function in the Stateflow Programmatic Interface can be used to achieve the same with charts and transitions. Here are the relevant documentation links.
- find_system - https://www.mathworks.com/help/releases/R2022a/simulink/slref/find_system.html
- find - https://www.mathworks.com/help/releases/R2022a/stateflow/api/stateflow.chart.find.html
An example is provided in the attached zip file. The code in the ‘script.m’ file searches the ‘example.slx’ Simulink model for the entities whose names contain the string ‘BL55’ and highlights them. The ‘hilite_system’ and ‘highlight’ functions are used to perform highlighting actions. You can learn more about them in the following documentation pages.
- hilite_system - https://www.mathworks.com/help/releases/R2022a/simulink/slref/hilite_system.html
- highlight - https://www.mathworks.com/help/releases/R2022a/stateflow/api/stateflow.state.highlight.html
On executing the script, the corresponding Simulink entities get highlighted as shown below.

Note that any interactions with the Stateflow chart will disable the highlighting. As a workaround you can navigate inside the Stateflow chart and highlight one chart/transition at a time, after finding them.
I believe this will assist you!
Catégories
En savoir plus sur Simulink Functions dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!