How to check for common elements among multiple arrays ? Number of arrays are more than 100 and sizes vary for each array

66 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 17 Jan. 2020
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

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by