How to save scope to an image file without using plot?
Asked Answered
C

3

5

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

Civilized answered 8/12, 2010 at 23:1 Comment(2)
I'm voting to close this one, it's too hard to figure out what the question is.Citrate
If I can try to interpret, do you mean you want to save the image shown in the Scope block, rather than using plot at the command line using saved data?Kcal
N
5

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:

Nonrigid answered 9/12, 2010 at 16:50 Comment(2)
Thanks for your answer. I used "saveas" method, it works but, it has a problem with stepped function. When it's ploted in scope I see straight vertical lines, but when it's ploted by plot method, there is lines, but at an angle.Civilized
@kspacja: My guess is that there is a slight difference in how the scope block displays step-like data. For example, let's say you have 3 data points, with a step at the second point. The scope block may be similar to plotting plot([1 2 2 3],[0 0 1 1]);, whereas the result of SIMPLOT may be similar to plotting plot([1 2 3],[0 0 1]). Notice how the first plot replicates point 2 for the x data (with a 0 and 1 for the y data), which makes a vertical line. The second plot would instead have a line joining point (2,0) to point (3,1).Nonrigid
H
3

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.

Home answered 7/11, 2013 at 11:19 Comment(0)
R
1

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

Roop answered 13/6, 2016 at 12:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.