22 lines
567 B
Matlab
22 lines
567 B
Matlab
function [outputArg] = savePlot(figure,path,format)
|
|
|
|
switch format
|
|
case "png"
|
|
savepath = sprintf("%s.png",path);
|
|
exportgraphics(figure,savepath);
|
|
case "pdf"
|
|
savepath = sprintf("%s.pdf",path);
|
|
exportgraphics(figure,savepath,'ContentType','vector');
|
|
case "fig"
|
|
saveas(figure,path,"fig");
|
|
case "m"
|
|
saveas(figure,path,"m");
|
|
otherwise
|
|
error("invalid filetype");
|
|
end
|
|
|
|
% return null (not relevant for plots!)
|
|
outputArg = [];
|
|
end
|
|
|