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?

采纳的回答

Fangjun Jiang
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 CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by