How to check for common elements among multiple arrays ? Number of arrays are more than 100 and sizes vary for each array
28 次查看(过去 30 天)
显示 更早的评论
result=mintersect(out{1,1},out{1,2},out{1,3},out{1,4},out{1,5},out{1,6},out{1,7},out{1,8},out{1,9},out{1,10},out{1,11},out{1,12},out{1,13},out{1,14},out{1,15},out{1,16},out{1,17},out{1,18},out{1,19},out{1,20},out{1,21},out{1,22},out{1,23},out{1,24},out{1,25},out{1,26},out{1,27},out{1,28},out{1,29},out{1,30},out{1,31},out{1,32},out{1,33},out{1,34},out{1,35},out{1,36},out{1,37},out{1,38},out{1,39},out{1,40})
Is there a better way to do it?
0 个评论
采纳的回答
Fangjun Jiang
2020-1-17
Use a loop
Com=intersect(out{1,1},out{1,2});
for k=3:size(out,2)
Com=intersect(Com,out(1,k));
if isempty(Com)
break;
end
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!