# How to find common numbers in 4 matrices

5 visualizzazioni (ultimi 30 giorni)
Cladio Andrea il 17 Gen 2015
Risposto: Roger Stafford il 17 Gen 2015
Hello i have 4 arrays,2001x1 and actually there is nothing in common for the rows but if i use 'ismember' then for some rows i got result '1' even if not all the numbers are the same for the row.
b = ismember(ismember(ismember(distancee6,machines(:,1)),kkk3),kkk);
i use this, how can i fix it to have an exact result? Thank you
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (1)

Roger Stafford il 17 Gen 2015
Apparently from your statement, "find common numbers in 4 matrices", you should be using matlab's 'intersect' function, not 'ismember'.
b = intersect(intersect(intersect(distancee6,machines(:,1)),kkk3),kkk);
or
b = intersect(intersect(distancee6,machines(:,1)),intersect(kkk3,kkk));
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Cell Arrays in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by