Find the different elements in a cell array

1 回表示 (過去 30 日間)
LL
LL 2021 年 11 月 23 日
コメント済み: LL 2021 年 11 月 29 日
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.

採用された回答

Stephen23
Stephen23 2021 年 11 月 23 日
編集済み: Stephen23 2021 年 11 月 23 日
Where out is your cell array:
fnh = @(v) any(v(:)==1)&&any(v(:)==2);
idx = cellfun(fnh,out)
  12 件のコメント
Stephen23
Stephen23 2021 年 11 月 29 日
@Lidia Frizzi: please show the expected result of that "merging".
LL
LL 2021 年 11 月 29 日
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.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by