Guide Object Browser Unused Objects

2 次查看(过去 30 天)
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?

回答(2 个)

Rutuja Shirali
Rutuja Shirali 2015-8-31
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.
  1 个评论
Pappu Murthy
Pappu Murthy 2015-9-1
Not true. They wont ever go away once you create them. In the object browser they are all listed. However, the respective callbacks and their functions can be deleted from the "m" code which I am able to do so. Why the object Browser still shows them, I have no clue.

请先登录,再进行评论。


Walter Roberson
Walter Roberson 2015-9-2
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
Sample output:
>> verifyfig('REPORT1')
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.
  1 个评论
Pappu Murthy
Pappu Murthy 2015-9-2
编辑:Pappu Murthy 2015-9-2
I tried your code and all I got was a bunch of errors!
Error using matlab.ui.Figure/horzcat While converting from 'cell': The conversion returned a value of class 'matlab.mixin.Heterogeneous', which cannot be inserted into an array of class 'matlab.ui.Figure'.
Error in verifyfig (line 228) badobjs{numbadobj} = [thisobj, callback_probs{:}]; %will form part of the output

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by