How to save scope to an image file without using plot?

无人久伴 提交于 2019-11-30 17:48:48

问题


This condition is very important, because plot stretches my graph in an unacceptable manner.


回答1:


If the comment by MikeT is correct, and you are trying to save the image shown in a Scope block, there are a couple of ways you could do this:

  • Print the contents of the scope window by clicking the Print icon, the leftmost icon on the Scope toolbar. Then choose to print to a file instead of to a printer.
  • Create an editable figure from a scope block using the SIMPLOT function. This will create a figure that looks like the display on the screen of a Scope block, then you can save the figure to a file using the figure window's File menu or the functions SAVEAS or PRINT.



回答2:


As the answer of gnovice is outdated (at least since R2013), and the new builtin function is rather inconvenient to use, I'd 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 a vector graphic in exactly the same size and look, like the last opened scope window. Of course you can modify additional properties and also print it as jpeg with a certain resolution. But then you should rather use print:

...
set(gcf,'Renderer','zbuffer')
print(gcf,'scope.jpg','-djpeg','-r600')

results into a 600dpi Jpeg file. The units doesn't really matter, as long as they are consistent between figure and paper.




回答3:


A quick solution would be to choose File - Print to Figure inside the scope. Then a Figure opens that you can save as .fig.



来源:https://stackoverflow.com/questions/4393217/how-to-save-scope-to-an-image-file-without-using-plot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!