- Search for all occurrences of a string in a Stateflow chart and highlight them Yellow.
- Create a Stateflow search toolbar for fast searching.
Note: Due to the redesign of the Stateflow interface in Matlab 2012b, this script doesn't work in newer versions of Matlab. I am submitting this to Matlab Central in the hopes that Matlab will see what type of search capabilities Stateflow should have.
sf_hilite - v1.0 - Search and Highlight Stateflow text
format: sf_hilite [options] [chart] search_pattern
-w Search for whole words only
-i Search is case insensitive
-f Search for plain text (no regular expressions)
-nc Ignore comments
-clear Clear current highlighting
-next Go to next occurrence
-prev Go to previous occurrence
-gcs Search all charts in current simulink model
-ncw Do not print results to matlab command window
-ocw Only print results to matlab command window (do not highlight chart)
-num Return the number of results (No command window output, no highlighting)
-load Load all Stateflow sub-charts into memory (for highlighting)
-gui [chart] Create SF toolbar search box for current chart
-guiall Create SF toolbar search box for all open charts
-hidegui [chart] Hide SF toolbar search box for current chart
-nogui Do not create search box
-nz Do not zoom to first occurrence
Note: Stateflow subcharts are not fully loaded until they are opened.
For this reason, the search may not be 100% accurate until all subcharts are opened at least once.
Use the -load option to open all subcharts and guaranty accuracy.
Brian (2021). Stateflow Search and Highlight for pre-Matlab 2012b (https://www.mathworks.com/matlabcentral/fileexchange/51092-stateflow-search-and-highlight-for-pre-matlab-2012b), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!