Print different name than that of the index in figure inside for loop
Show older comments
Hello everyone!
I have the next piece of code that gives me a figure of my 4 txt files named e2, e32, e64, e100 for each and every one of the 10 columns that each txt has , hence the for loop goes from 1 to 10 (my txts are 8 rows and 10 columns each).
My problem is that in the title and the name of the saved figure I would like to display a different set of 10 names and not the index i of the for loop .
For example display 10, 100, 200, ....up to 900 and not 1,2,3... ,10
Is there a way to do that?
for i = 1 : 10
figure;
plot(e2(:,i),'LineWidth',2);
hold on;
plot(e32(:,i),'LineWidth',2);
hold on;
plot(e64(:,i),'LineWidth',2);
hold on;
plot(e100(:,i),'LineWidth',2);
hold off;
title(sprintf('%d ', i));
exportgraphics(gca,sprintf('%d.png', i));
end
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing 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!