Clearing a subplot array of images on a canvas of GUI
1 次查看(过去 30 天)
显示 更早的评论
Hello. I am plotting a set of images whilst in a loop using subplot and its position vector method. In my loop, the values of x and y change. This all works fine and plots to the canvas in my GUI.
positionVector = [os+x, y, width, 0.05];
subplot('Position',positionVector);
hold off;
Does anyone know how to clear this array of images on the canvas??
Thanks Jason
0 个评论
采纳的回答
Geoff Hayes
2014-9-18
Jason - do you wish to clear the image from each subplot, or remove the subplots from the canvas/figure?
One way (for either case) is to manage a list of the handles for each subplots
hSubplots = [];
for …
% do stuff
% position subplot
positionVector = [os+x, y, width, 0.05];
h = subplot('Position',positionVector);
% update handle array
hSubplots = [hSubplots ; h];
hold off;
end
Then to delete/remove the subplot from the figure, you would do
delete(hSubplots(k));
cla(hSubplots(k),'reset');
for each subplot k.
7 个评论
Geoff Hayes
2014-9-18
Jason - see Image Analyst's comment to get the handles of all axes (subplots) on the figure. Their "information" is "stored" within the parent figure.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!