How to avoid: "... . Cannot clear this class or any of its super-classes."
Show older comments
I have a GUI, MyGui, which contains a dozen uicontrols. There is nothing fancy: no timers, no listeners, ... . The uicontrols are wrapped up in user defined classes in a hierarchy. (It's about reuse of functional groups of uicontrols.) MyGui doesn't include any special code to handle the close down process. Handle graphic handles are values of user class properties.
The following steps illustrates the problem
- restart Matlab
- start MyGui
- close MyGui by using the red close-button in the upper right corner
So far everything seems to be ok. Next, I try to clear the classes, which wraps the uicontrols:
>> clear all, clear classes
which produces a dozen warnings, one for each wrapper
Warning: Objects of 'ToggleButton' class exist. Cannot clear this class or any
of its super-classes.
.....
To cleanup, I need to restart Matlab. There must be a better way!
In search for a solutions I
- read the entries in the documentation on "Object Lifecycle".
- experiment with the FEX-contribution ScrollPanel by Jason Kinchen
The documentation make me believe that Matlab is intended to handle the cleanup automatically. ScrollPanel doesn't exhibit the problem and I cannot find any special code to ensure that the instance of ScrollPanel is deleted. There is code to ensure that handle graphic objects are deleted if ScrollPanel is deleted.
I have search www.mathworks.com for "Cannot clear this class" more than once without finding anything except for issues in rather special circumstances.
So what should I do next?
2 Comments
Matt J
on 17 Dec 2012
MyGui doesn't include any special code to handle the close down process. Handle graphic handles are values of user class properties.
You might want to clarify this part. If you have user-defined handle classes, you should be implementing delete() methods for those classes.
per isakson
on 17 Dec 2012
Edited: per isakson
on 17 Dec 2012
Accepted Answer
More Answers (0)
Categories
Find more on Testing Frameworks 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!