What happens to cleared custom `handle` objects?
I know that MATLAB exposes the handle class which alllows one to define passed-by-reference objects like:
classdef ConcreteHandle < handle
properties
UserData = []
end
methods
function self = ConcreteHandle(data)
arguments
data = []
end
self.UserData = data;
end
end
end
How does the behaviour of this class differ from the existing graphical handle objects? For example:
fh = figure;
clear fh
Doesn’t delete the figure (but close(fh) or delete(fh) will). Even after the reference to fh is cleared you can still recover it with built-in utilities like findall():
fh = findall(0, ‘Type’, ‘Figure’);
What happens if I construct an instance of my custom class:
c = ConcreteHandle();
clear c
Is c (and the data in c.UserData) handed over to the gargabe collector? Does there exist an equivilant call to findall() or a similar utility that lets me find c?I know that MATLAB exposes the handle class which alllows one to define passed-by-reference objects like:
classdef ConcreteHandle < handle
properties
UserData = []
end
methods
function self = ConcreteHandle(data)
arguments
data = []
end
self.UserData = data;
end
end
end
How does the behaviour of this class differ from the existing graphical handle objects? For example:
fh = figure;
clear fh
Doesn’t delete the figure (but close(fh) or delete(fh) will). Even after the reference to fh is cleared you can still recover it with built-in utilities like findall():
fh = findall(0, ‘Type’, ‘Figure’);
What happens if I construct an instance of my custom class:
c = ConcreteHandle();
clear c
Is c (and the data in c.UserData) handed over to the gargabe collector? Does there exist an equivilant call to findall() or a similar utility that lets me find c? I know that MATLAB exposes the handle class which alllows one to define passed-by-reference objects like:
classdef ConcreteHandle < handle
properties
UserData = []
end
methods
function self = ConcreteHandle(data)
arguments
data = []
end
self.UserData = data;
end
end
end
How does the behaviour of this class differ from the existing graphical handle objects? For example:
fh = figure;
clear fh
Doesn’t delete the figure (but close(fh) or delete(fh) will). Even after the reference to fh is cleared you can still recover it with built-in utilities like findall():
fh = findall(0, ‘Type’, ‘Figure’);
What happens if I construct an instance of my custom class:
c = ConcreteHandle();
clear c
Is c (and the data in c.UserData) handed over to the gargabe collector? Does there exist an equivilant call to findall() or a similar utility that lets me find c? handles, graphics MATLAB Answers — New Questions