how to count no of zeros between ones
6 ビュー (過去 30 日間)
古いコメントを表示
suppose my array is
a=[0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0]
output i want is
[2 4 4 1 2]
0 件のコメント
採用された回答
Walter Roberson
2021 年 7 月 9 日
a=[0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0]
starts = strfind([1 a], [1 0])
stops = strfind([a 1], [0 1])+1
stops - starts
参考
カテゴリ
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!