Since gnovice's answer is deprecated (at least with R2013) and the new built-in function is rather inconvenient to use, I would like to suggest my little script.
set(0,'ShowHiddenHandles','On') set(gcf,'Units','centimeters','PaperUnits','centimeters') pos = get(gcf,'Position'); set(gcf,'PaperPosition',[0 0 pos(3) pos(4)],'Papersize',[ pos(3),pos(4) ]); set(gcf,'InvertHardcopy','off','Renderer','painters') saveas(gcf,'scope.pdf')
Which gives you vector graphics of exactly the same size and looks like the last window of an open area. Of course, you can change additional properties, as well as print it as jpeg with a certain resolution. But then you better use print :
... set(gcf,'Renderer','zbuffer') print(gcf,'scope.jpg','-djpeg','-r600')
results in a 600 dpi Jpeg file. Units do not matter much if they are consistent between the pattern and the paper.
source share