How can I create a for loop to count letters in a sequence?
1 回表示 (過去 30 日間)
古いコメントを表示
i have the following sequence
a = b c d b c d e c c d b c b e e
i want to create a for loop to identify the number of b’s and c’s in the sequence?
help please
0 件のコメント
採用された回答
madhan ravi
2018 年 11 月 19 日
編集済み: madhan ravi
2018 年 11 月 19 日
No loops needed:
a = 'b c d b c d e c c d b c b e e'
no_of_bs=sum(ismember(a,'b'))
no_of_cs=sum(ismember(a,'c'))
3 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!