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

31 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 17 de En. de 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

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by