vector array in matlab
1 回表示 (過去 30 日間)
古いコメントを表示
assume i have folllowing vector column named as ALT_digit_

i want to know the number of times 'hi' comes in the vector column.
0 件のコメント
採用された回答
その他の回答 (2 件)
Adam Danz
2022 年 2 月 10 日
編集済み: Adam Danz
2022 年 2 月 10 日
1 件のコメント
Adam Danz
2022 年 2 月 10 日
If your only string values are 'hi' 'lo' or '' and your Matlab release is R2016b or later, this solution is perfectly fine. But if you're using a release prior to 16b or combinations of 'hi' and 'lo', consider using a different method.
Image Analyst
2022 年 2 月 10 日
Yes another way : using ismember():
ALT_digit = {'lo', '', '', '', 'lo', '', '', '', 'lo', '', 'abc'}
rows = ismember(ALT_digit, 'lo')
count = sum(rows)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!