필터 지우기
필터 지우기

Saving a matlab figure file without displaying it

조회 수: 33 (최근 30일)
TP Das
TP Das 2015년 2월 3일
댓글: Benjamin Abruzzo 2020년 5월 28일
Usually I generate a matlab plot using plot command and then save it for offline viewing. When I have to do the same for, say, 1000 plots, displaying each of them before saving becomes time consuming. Is there a way to save a matlab plot as jpeg without displaying it?

채택된 답변

Titus Edelhofer
Titus Edelhofer 2015년 2월 3일
Hi,
you might open the figure invible:
f = figure('visible', 'off');
surf(peaks);
print -djpeg test.jpg
close(f)
It will still take some time, though.
Titus

추가 답변 (2개)

Blanca Larraga
Blanca Larraga 2018년 6월 4일
Hi, I do this but the .jpeg are empty. Is there anything else I should consider?

Y. J.
Y. J. 2018년 7월 26일
Hey I have a similiar problem. I'm plotting in a invisible figure in the first time that works good but if I want to hold on the plot and plot another one in it, it is overwriting the first plot? Any Idea for that?
  댓글 수: 1
Benjamin Abruzzo
Benjamin Abruzzo 2020년 5월 28일
Thy this
f = figure('visible', 'off');
X = rand(10,1); Y = rand(10,1); Z = rand(10,1);
hold on
plot(X,Y)
plot(X,Z)
plot(Y,Z)
hold off
print -djpeg test.jpg
close(f)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by