## Reading multiple columns of an excel sheet to output a range of values. Please see the example

JAGAN MOHAN KUMMARI

### JAGAN MOHAN KUMMARI (view profile)

님이 질문을 제출함. 27 Sep 2019
최근 활동 JAGAN MOHAN KUMMARI

### JAGAN MOHAN KUMMARI (view profile)

님이 댓글을 추가함. 6 Oct 2019
Hi,
I am reading multiple columns of an excel sheet, where two columns are a set.
Columns from A to Z, which are sets of AB, CD, EF, GH... YZ
Col A: 1 2 3 4 5 6 7 8 9 10
Col B: 0 3 5 15 30 40 55 85 95 100
I need the output values of ColA and ColB, based on i) ColB>5 & ColB<95 ii)ColB>15 & ColB<85
Answer here would be
Casei)
Col A: 3 4 5 6 7 8 9
ColB: 5 15 30 40 55 85 95
Caseii)
ColA: 4 5 6 7 8
ColB: 15 30 40 55 85
I am able to get these values with the following code. However, I am looking for output of other columns as well like for (ColC,ColD), (ColE, ColF)... (ColY, ColZ). Also the size of the the range for all 13 pairs.
c1=D(:,1);
c1(isnan(c1))=[];
c2=D(:,2);
c2(isnan(c2))=[];
c2t90=c2>=5 & c2<=95;
C2t90=c2(c2t90);
C1t90=c1(c2t90);
frd1t90=[C1t90 C2t90];
dt1t90=size(C1t90);
c2t70=c2>=15 & c2<=85;
C2t70=c2(c2t70);
C1t70=c1(c2t70);
frd1t70=[C1t70 C2t70];
dt1t70=size(C1t70);
Look forward to an output.
Thanks,

로그인 to comment.

## 답변 수: 1

Gaurav Garg

### Gaurav Garg (view profile)

님의 답변 3 Oct 2019

Hi,
I understand that you wish to look for output of other columns as well.
What you can try doing is to write a loop which accesses all the columns of D (the matrix which stores data.xlsx Sheet3) and computes the values of columns based on the conditions specified.
An example -
for i=1:2:26
c1=D(:,i);
c1(isnan(c1))=[];
c2=D(:,i+1);
c2(isnan(c2))=[];
c2t90=c2>=5 & c2<=95;
C2t90=c2(c2t90);
C1t90=c1(c2t90);
frd1t90=[C1t90 C2t90];
dt1t90=size(C1t90);
c2t70=c2>=15 & c2<=85;
C2t70=c2(c2t70);
C1t70=c1(c2t70);
frd1t70=[C1t70 C2t70];
dt1t70=size(C1t70);
end

#### 댓글 수: 1

JAGAN MOHAN KUMMARI

### JAGAN MOHAN KUMMARI (view profile)

6 Oct 2019
Thanks Gaurav,
But I am using the old one only. I still have few more operations from the same data.
Thanks again
Cheers

로그인 to comment.

Translated by