Filter löschen
Filter löschen

shall I plot some figure to save without show?

1 Ansicht (letzte 30 Tage)
vx2008
vx2008 am 1 Mär. 2017
Bearbeitet: Gaetano Pavone am 23 Mär. 2021
I want to plot some figures by functions 'bar' and 'plot', but I don't want this figure being shown and just want to save it on somewhere; shall I?

Akzeptierte Antwort

KSSV
KSSV am 1 Mär. 2017
figure('Visible','off')
plot(rand(1,100))
saveas(gcf,'myfigure.fig','fig') % give extension you want
  2 Kommentare
vx2008
vx2008 am 1 Mär. 2017
thank you very much; it is very usefull.
Gaetano Pavone
Gaetano Pavone am 23 Mär. 2021
Bearbeitet: Gaetano Pavone am 23 Mär. 2021
@KSSV I have another question about this topic.
In my code, I show and save a plot obtained by using a function.
Such two operations are available if I set two variables (showfig and outputsave, respectively) equal to 1, vice versa, they are unavailable if I turn the parameters as zero.
Thus my question is:
How can I save the plot without showing it?
I have tried to use your suggestion, but it doesn't work.
In my function there is:
if showfig==1
set(gcf,'Visible','off')
else
set(gcf,'Visible','on')
end
...
...
if outputsave==1
savefig ('myfigure.jpeg')
end

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Animation finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by