![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/279087/image.png)
Solution for a Subplot in loop reading from multiple columns with an increment and from different excel sheets
1 view (last 30 days)
Show older comments
JAGAN MOHAN KUMMARI
on 24 Mar 2020
Commented: JAGAN MOHAN KUMMARI
on 24 Mar 2020
Hi all,
I am reading a .xlsx file with three sheets. I am trying to subplot x and y from each sheet which are in increments.
Here is the example for subplot (8,3,1)
Example 1: Subplot 1 includes the following data
(x1,y1)=(a(:,1),a(:,2)) % continues with an increment of 3 columns for subplot (8,3,2) and so on.
(x2,y2)=(b(:,1),b(:,2)) % continues with an increment of 3 columns for subplot (8,3,2) and so on.
(x3,y3)=(c(:,1),c(:,2)) % continues with an increment of 3 columns for subplot (8,3,2) and so on.
The following code is just getting them all in a single chart.
a=xlsread('Doc1.xlsx','sheet1');
b=xlsread('Doc1.xlsx','sheet2');
c=xlsread('Doc1.xlsx','sheet3');
x1=a(:,1:3:70);
y1=a(:,2:3:71);
x2=b(:,1:3:70);
y2=b(:,2:3:71);
x3=c(:,1:3:70);
y3=c(:,2:3:71);
figure(1)
plot(x1,y1,x2,y2,x3,y3)
figure(2)
for t1=1:24
subplot(8,3,t1)
plot(x1,y1,x2,y2,x3,y3)
end
figure(2) gives all the sublpots with all the data. Can someone look into this code and suggest me how to overcome this?
Kind regards,
Jagan
0 Comments
Accepted Answer
More Answers (0)
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!