identifing the beginning and the end of a series
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I have long vectors that have the following structures of zeros and ones: 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 How can I identify the 0 that comes before the series of ones? i.e observation 1 and 14. Using the same logic, how can I identify the end of series of ones i.e observations 8 and 21?
댓글 수: 0
채택된 답변
Wayne King
2012년 4월 27일
I = find(diff(x)==1);
J = find(diff(x)== -1);
I is 1 and 14, J is 8 and 21
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 System Identification Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!