Need help in finding common values in cell. For example i have a cell like cc={[1 2 3],[1 2 4 5];[1 2 8 7 9 5],[1 3 8 7 2]}; then i want output as [1 2] as it is common in all cell matrix.

 Réponse acceptée

Voss
Voss le 17 Juin 2022
cc = {[1 2 3],[1 2 4 5];[1 2 8 7 9 5],[1 3 8 7 2]};
result = cc{1};
for jj = 2:numel(cc)
result = intersect(result,cc{jj});
end
disp(result);
1 2

2 commentaires

Voss
Voss le 17 Juin 2022
( @Tukaram Zore Answer moved here: )
Thank You very much.
Voss
Voss le 17 Juin 2022
@Tukaram Zore You're welcome!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by