フィルターのクリア

Index of the colums which contains only specific char 'B'

1 回表示 (過去 30 日間)
Dora de Jong
Dora de Jong 2021 年 3 月 23 日
コメント済み: Dora de Jong 2021 年 3 月 23 日
Cell array values and words.
Want to find which colums contains only B's
a = {
1 'B' 2 'B' ;
'B' 'B' 'B' 'B' ;
1 2 'B' 'A';
}
Wanted outcome:
b =[0;1;0]
This is a simplified version of the entire array a.

採用された回答

Adam Danz
Adam Danz 2021 年 3 月 23 日
編集済み: Adam Danz 2021 年 3 月 23 日
Use strcmp or strcmpi along with all.
Template:
all(strcmp(a,'B'),1) % for columns
all(strcmp(a,'B'),2) % for rows
  4 件のコメント
Dora de Jong
Dora de Jong 2021 年 3 月 23 日
Thank you so much!!
Dora de Jong
Dora de Jong 2021 年 3 月 23 日
Yes you are right I mean rows.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by