Open callback function script in Editor for a specific component in GUI
7 views (last 30 days)
Show older comments
__Hi everybody. I created GUI in script. I have a lot of components and a lot of callback functions in different files. Is it possible to open callback function for specific component i see in GUI. Of course i can find this function by myself among bunch of files. But may be there is a button to open it fast in editor for a component selected in GUI.
2 Comments
Walter Roberson
on 22 Nov 2019
This turns out to be more difficult than you would expect.
Mathworks Support tells me that there is no interface available that can report whether a particular file defines a particular function. That means that you cannot iterate between all of your files asking for each "are you the file that defines the function I am looking for" and opening the file for editing if it is.
Instead you have to do text processing, such as searching for "function" followed by the name of the function. This is risky because you have to account for quoted strings and multiple styles of comments.
There is another possibility: someone (Stephen I think) hacked one of the Mathworks provided code analysis scripts to be able to analyze code. In theory that could be hacked even further to detect function definitions and figure out line numbers.
Answers (0)
See Also
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!