![](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 (최근 30일)
이전 댓글 표시
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
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Subplots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!