Matlab存图
一、不可见figure存图
1、
pic = figure('Visible','off');
set(pic,'position',[0 0 600 350]) % 如果手动拖放,则不需要这一行命令
set(pic, 'PaperPositionMode', 'auto') % Use screen size
plot( x,y,'-r','Linewidth',1.5)
saveas(pic,'weilitu','png');
2、
saveas(pic,['history\wlt\', datestr(datetime('now'),'yyyymmddHHMMSS.png')])
二、控件界面存图
% zxy
new_f_handle=figure('visible','off'); %新建一个不可见的figure
new_axes=copyobj(handles.fig_wlt,new_f_handle); %axes1是GUI界面内要保存图线的Tag,将其copy到不可见的figure中
set(new_axes,'Units','normalized','Position',[0.1 0.1 0.8 0.8]);%将图线缩放
print(new_f_handle,'-djpeg','./weilitu.jpg');
print(new_f_handle,'-dpng','./weilitu.png');
print(new_f_handle,'-dbmp','./weilitu.bmp');
% zxy
长风破浪会有时,直挂云帆济沧海!
可通过下方链接找到博主
https://www.cnblogs.com/judes/p/10875138.html