How to save multiple figures created by bar() in a loop with different name?
3 次查看(过去 30 天)
显示 更早的评论
I have seen many posts regarding this but none of them worked for me. I have the following code in which I want to save created figures in two formats .fig and .png. But every time the compiler says "Unable to open file "E:\figs\RX 1: Iteration= 100.fig" for output."
fpath = 'E:\figs\';
% Plotting the results
c = X; % Something in c
for i = 1:size(input,1)
figure(i);
title(sprintf('RX %d: Iteration=%d, zeta=%3.2f, n=%d, p=%d',i,iteration_count_par,zeta_par,n_par,p_par));
ylabel('Ratio (%)');
hold on;
y = Y; % Something in y
bar(c,y);
legend('Accuracy','False Positive Ratio','False Negative Ratio');
fname = sprintf('E:\figs\RX %d: Iteration=%d',i,iteration_count_par);
saveas(gca,fullname(fpath,fname),'fig');
saveas(gca,fullname(fpath,fname),'png');
hold off;
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Printing and Saving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!