how to compare the elements of 2 cell arrays and get their rows from cell2?
1 次查看(过去 30 天)
显示 更早的评论
Hi Friends, I have 2 cell arrays cell1(1*1) and cell2(1*2) I want to compare the elements of cell1 with cell2 and when all the elements of cell 1 exist in both members of cell2 then get its corresponding row from cell2.
Input:
cell1={gene1;gene2;gene3;gene4;gene5}
cell2={gene1,gene3;gene10,gene100;gene2,gene5}
output
out={gene1,gene3;gene2,gene5}
I have tried isequal and find(ismember) and get empty array.
5 个评论
回答(1 个)
KSSV
2017-5-15
cell1={'gene1';'gene2';'gene3';'gene4';'gene5'} ;
cell2={'gene1','gene3';'gene10','gene100';'gene2','gene5'} ;
out={'gene1','gene3';'gene2','gene5'} ;
[ia,ib] = ismember(cell2,cell1) ;
cell2(ia)
3 个评论
KSSV
2017-5-15
load cell1.mat ;
load cell2.mat ;
cell1 = PPI_data ;
cell2 = Stage1Exp10_data{1} ;
cell1 = [cell1{1} cell1{2}] ;
[ia,ib] = ismember(cell2,cell1) ;
cell2(ia)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genomics and Next Generation Sequencing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!