MATLAB: Command for one copy of 3 figure in subplot form and put it in only one picture in bmp format

copypicturesubplot

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

Best Answer

saveas() works on a figure not on a axes, so the following code will save the whole figure no matter running saveas(h,...) or saveas(s2,...). If you really want to save the subplot, you need to plot that subplot in a separate figure and then save it. Maybe you can do further re-sizing to achieve the sub-plot effect.
>> h=figure;
>> s1=subplot(311);plot(1:10)
>> s2=subplot(312);plot(rand(10,1))
>> s3=subplot(313);plot(magic(3))
>> saveas(s2,'subplot2','jpg')
>> saveas(h,'AllPlot','jpg')