figures created in a loop are incrementing in size
Show older comments
I have some code that is creating and saving the figures that I want it to, but I have noticed that the size of each .fig file is gradually incrementing, starting at about 2Mb and increasing after 600 plots to 160Mb (which fairly obviously is a problem in terms of disk space usage!).
I would like to know how to improve my code so that this problem doesn't occur (and to know why it IS occurring). Thanks.
for ii=1:11
for jj = 1:5
for kk=1:6
filename = sprintf('man_%d_%d_%d',ii,jj,kk);
AppFilt2(filename);
end
end
end
function AppFilt2(filename)
load(filename);
[some other stuff that has nothing to do with figures]
%plot right
clear fig;
g=@plot;
g(R,'Color',[0 0 0.6]);
newname = [filename '-unfiltR.fig'];
hgsave(newname);
clear fig;
gg=@plot;
gg(Rf,'b')
newname = [filename '-filteredR.fig'];
hgsave(newname);
%plot left
clear fig;
h=@plot;
h(L,'Color',[0.6 0 0.6]);
newname = [filename '-unfiltL.fig'];
hgsave(newname);
clear fig;
hh=@plot;
hh(Lf,'m');
newname = [filename '-filteredL.fig'];
hgsave(newname);
%plot right over left
hold on
ggg=@plot;
ggg(Rf,'b')
newname = [filename '-filteredboth.fig'];
hgsave(newname);
end
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices 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!