How to save figures directly to a folder without having them display?

311 ビュー (過去 30 日間)
Zach Dunagan
Zach Dunagan 2017 年 12 月 12 日
編集済み: Zach Dunagan 2017 年 12 月 15 日
I have a set of plots, in other words figures, that need to be saved directly to the folder. I have the code set up where it saves the figures to a folder, but they display and then close. I don't even want them to display, rather save directly to the folder. Can Someone write up a small example or at least tell me the commands needed?

採用された回答

Chris Perkins
Chris Perkins 2017 年 12 月 14 日
Hi Zach,
When you create a figure, you can set the 'visibile' property to 'off', which will cause it not to display. Then anything you plot on that figure will also not be displayed.
Here is a brief example:
f = figure('visible','off');
plot(1:10); % Do whatever plotting you want to here
saveas(f,'savedFigure','jpg');
The figure will still be saved in your Workspace as 'f' after this, but MATLAB will not have displayed it in a figure window.
  1 件のコメント
Zach Dunagan
Zach Dunagan 2017 年 12 月 14 日
編集済み: Zach Dunagan 2017 年 12 月 15 日
What happens if I have a for loop controlling the number of plots? The code you gave me was for a single plot, what if I have t = 30 plots?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Find more on Specifying Target for Graphics Output in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by