Saving figures in matlab

1 回表示 (過去 30 日間)
Aftab Ahmed Khan
Aftab Ahmed Khan 2014 年 7 月 17 日
コメント済み: Azzi Abdelmalek 2014 年 7 月 17 日
Hi everyone, I have this function for saving my plotting my results, i want to know that how can i save these 3 figures to the hard-disk. Like everytime i run the simulation, these figures are saved and updated.
function plot_results()
%%definition of the global variable
global block_Pb theo_Pb Troughput total_delay arrival_rate
figure(1),
hold on;
plot(arrival_rate, block_Pb,'-r*', arrival_rate, theo_Pb,'-b*');
xlabel('Files arrival rate per user (Files/sec)');
ylabel('Blocking Probability (Pb)');
title('Comparison btw calculated Pb & Erlang Pb');
legend('Calculated Pb','ErlangB Pb');
hold off;
figure(2),
plot(arrival_rate, Troughput,'-b*');
xlabel('Files arrival rate per user (Files/sec)');
ylabel('Throughput (Mbps)');
title('Throughput verses files arrival rate');
figure(3),
plot(arrival_rate, total_delay,'-b*');
xlabel('Files arrival rate per user (Files/sec)');
ylabel('Total Transmission Delay (sec)');
title('Total transmission delay verses files arrival rate');
end

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 7 月 17 日
% Example
h=plot(sin(0:0.01:10))
saveas(h,'your_file.jpg')
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 7 月 17 日
You can also use hgsave and hgload functions
h=plot(sin(0:0.01:10))
hgsave(h,'fileame')
% to open your figure
hgload('filename')

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

その他の回答 (1 件)

Joseph Cheng
Joseph Cheng 2014 年 7 月 17 日
if there a specific format that you're looking to save to? you can use the savefig() function to save it as a matlab fig file.
  1 件のコメント
Joseph Cheng
Joseph Cheng 2014 年 7 月 17 日
or if you want a jpg or something else you can use the saveas() function and do something like this.

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

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by