2012-05-07 9 views
7

私は時系列をプロットする関数を持っていますが、これをイメージとして保存したいのですがどうしたらいいですか?MatlabでプロットをPNG形式で保存する

function TimeSeriesImages(a, b, c, d, e, f, g, h, i, j, k, l) 
x = [a b c d e f g h i j k l]; 
ts1 = timeseries(x,1:12); 
ts1.Name = 'Monthly Count'; 
ts1.TimeInfo.Units = 'months'; 
ts1.TimeInfo.Format = 'mmm dd, yy' 
ts1.Time=ts1.Time-ts1.Time(1); 
plot(ts1) 
end 
+0

おそらく関連[こちら](http://stackoverflow.com/questions/606768/write-a-a-figure-to-a-file-automatically-in-matlab) – hhh

答えて

14

Matlabで数値を保存する別の方法は、変数を使って数値を保存し、後で保存することです。例えば

a=bar(...); 
b=hist(...); %some figures 
c=plot(...); 

saveas(a, 'path\to\file\abc1.png','png'); 
saveas(b, 'path\to\file\abc2.png','png'); 
saveas(c, 'path\to\file\abc3.png','png'); 

フラグメント公式MATLABヘルプから:

名前を付けて保存 - 指定された形式

構文を使用してFigureまたはSimulinkブロック線図を保存

人の
saveas(h,'filename.ext') 
saveas(h,'filename','format') 

説明

名前を付けて保存(H、 'ファイル名。拡張子が') ファイルのファイル名。拡張子にハンドルhを持つ図形やSimulinkのブロック図を保存します。ファイルの形式は、拡張子extによって決まります。 詳細については、Matlabのヘルプを参照してください。

6

あなたは-dpngフラグ付きprintを使用することができます。

+0

ありがとうございました。 – Xupla

+0

[print in the Matlab Doc](http://www.mathworks.co.uk/help/matlab/ref/print.html)を参照してください。 –

+0

この方法は、解像度を変更できる点で若干優れています。 –

関連する問題