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.

 Akzeptierte Antwort

Voss
Voss am 17 Jun. 2022

0 Stimmen

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 Kommentare

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Gefragt:

am 17 Jun. 2022

Kommentiert:

am 17 Jun. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by