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!