Guide Object Browser Unused Objects
4 views (last 30 days)
I have GUI developed over a period of time and is working fine. In the process I had introduced a few edit boxes and later removed them and deleted the respective callbacks, and creatFcns etc.. Everything is working smoothly now, however, when I look into Object Browser that still shows a number of those edit boxes which are no longer used nor there anywhere in the code. Can I get rid of them from Object Browser?
Rutuja Shirali on 31 Aug 2015
I understand that you are still able to view a few edit boxes in the object browser even after you have removed them and their respective callbacks. I tried reproducing this issue on MATLAB R2014b but I was not able to reproduce it. I added a few edit boxes and then removed them and they were no more visible in the object browser.
Make sure that all the references and handles to those edit boxes are removed and you are saving the code after deletion.
Walter Roberson on 2 Sep 2015
Here is some code to test figures and .fig files to verify the reasonableness of callbacks. All kinds of callbacks are examined and a number of different conditions are potentially reported.
You can use
verifyfig('NameOfFig') %that .fig file specifically
verifyfig() %all current figures
verifyfig(figure(17)) %specific graphics object(s)
and there is an optional second argument for excluding some kinds of object types such as uimenu
Callback problems detected
-> in type "uicontrol" object with id 358.0018310546875 Tag "edit1"
--> in type "figure" object with id 532.000244140625 Tag "figure1"
Suspicious callback "Callback" because anonymous function refers to unfound routine "edit1_Callback"
Suspicious callback "CreateFcn" because anonymous function refers to unfound routine "edit1_CreateFcn"
Note: it is common for GUIDE callbacks to not be found. This version of the code is not able to look inside the .m file corresponding to a .fig file in order to determine whether the routines are there. You will need to look over the outputs carefully as the ones you are looking for will be hidden there. On the other hand if you already know the names from the object browser then this tool will help you to track down where the reference to the object is.
There are some enhancements possible to this code, but I just wrote it to answer this Question.