Filter löschen
Filter löschen

Extract overlapped rows from two excel files

1 Ansicht (letzte 30 Tage)
Cassie
Cassie am 12 Apr. 2011
Hey all, I am a newbie for Matlab and sorry for the silly questions. Assume there are two excel files,excel1 and excel2. Excel1 contains students names and their scores for English and Math such as row1=(John,98.5,74.5),row2=(Cassie,68.53,74,8)row3=(Bob,95.23,82.65)..etc. Excel 2 which contains only a few students' names such as only John and Bob. Is there any way to extract rows of John and Bob and save their scores in a matrix ? So the final matrix should be A(1,1)=98.5 A(1,2)=74.5, A(2,1)=95.23 and A(2,2)=82.65. Thank you very much,

Akzeptierte Antwort

Oleg Komarov
Oleg Komarov am 12 Apr. 2011
[data1, text1] = xlsread(xls1);
[data2, text2] = xlsread(xls2);
[text,pos] = intersect(text1,text2);
data1(pos,:)
  1 Kommentar
Cassie
Cassie am 12 Apr. 2011
Hey,
It is working great and thank you very much. :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by