How to save multiple figures created by bar() in a loop with different name?
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
See Also
Categories
Find more on Subplots 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!