command for one copy of 3 figure in subplot form and put it in only one picture in bmp format
Show older comments
anyone know how can copy a figure in subplot form and put(for example in .bmp format) it in a specified folder. there are 3 figures in subplot form
Accepted Answer
More Answers (1)
Grzegorz Knor
on 6 Sep 2011
Is this what you meant?
% example figure
subplot(311)
plot(rand(100,1),'r')
subplot(312)
bar(rand(5,1))
subplot(313)
semilogy(1:10)
% save
print(gcf,'-dbmp','C:\Documents and Settings\user\My Documents\MATLAB\picture.bmp')
2 Comments
Grzegorz Knor
on 6 Sep 2011
Alternatively:
% example figure
s(1) = subplot(311);
plot(rand(100,1),'r')
s(2) = subplot(312);
bar(rand(5,1))
s(3) = subplot(313);
semilogy(1:10)
% save
h = figure;
for k=1:3
copyobj(s(k),h)
print(h,'-dbmp',['C:\Documents and Settings\grzesiek\My Documents\MATLAB\picture' num2str(k)])
clf
end
close(h)
or
% save
h = figure;
for k=1:3
copyobj(s(k),h)
set(gca,'Units','normal','Position',[.1 .1 .8 .8])
print(h,'-dbmp',['C:\Documents and Settings\grzesiek\My Documents\MATLAB\picture' num2str(k)])
clf
end
close(h)
mohammad
on 6 Sep 2011
Categories
Find more on Subplots 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!