How to generate multiple graphs per page in several pages in one loop?
Show older comments
Hi everyone,
I would like to create a single loop that will generate several pages of graphs. Moreover, I would like each page to contain 8 graphs. For example, if I have a matrix
A = randn(100,16);
I would like to create 2 pages of 8 graphs each. How could I change the following code in order to create the graphs in one loop
varnames_i = {'1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16'};
time = datetime(2000,1:100,1);
figure;
for k = 1:8
subplot (4,2,k)
filename1 = plot( time' , A( : , k ) );
xlim(datenum([min(time) max(time)]))
title ( varnames_i(k));
hold on
end
saveas(filename1, '1_8.jpg');
figure;
for k = 1:8
subplot (4,2,k)
filename2 = plot( time' , A( : , 8+k ) );
xlim(datenum([min(time) max(time)]))
title ( varnames_i(8+k));
hold on
end
saveas(filename2, '9_16.jpg');
4 Comments
KALYAN ACHARJYA
on 15 Dec 2017
Edited: KALYAN ACHARJYA
on 15 Dec 2017
You can use the following way,
result=[graph1,graph2,graph3,graph4;graph5...]
% Plese mind it, display in the same row and semicolon display in next row, same as matrix elements imshow(result);
gsourop
on 15 Dec 2017
KALYAN ACHARJYA
on 15 Dec 2017
Sorry, I am not getting your question.
gsourop
on 15 Dec 2017
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!