Find the different elements in a cell array

1 Ansicht (letzte 30 Tage)
LL
LL am 23 Nov. 2021
Kommentiert: LL am 29 Nov. 2021
Hi to all,
i have a problem because i have a cell array and i need to find the cells that contain both numbers 1 and 2.
Thanks.

Akzeptierte Antwort

Stephen23
Stephen23 am 23 Nov. 2021
Bearbeitet: Stephen23 am 23 Nov. 2021
Where out is your cell array:
fnh = @(v) any(v(:)==1)&&any(v(:)==2);
idx = cellfun(fnh,out)
  12 Kommentare
Stephen23
Stephen23 am 29 Nov. 2021
@Lidia Frizzi: please show the expected result of that "merging".
LL
LL am 29 Nov. 2021
So for example in the rows 6-7 and colums 8-9 i have three cells not empty the result that i would like to obtain is like this.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by