Remove duplicate values, but keep the initial
    조회 수: 4 (최근 30일)
  
       이전 댓글 표시
    
For example, i have
x = [0 0 0 1 1 0 0 0 1 0 1 0]
I want the index of the first zero or one, but not the duplicates.
So the vector should become:
0 1 0 1 0 1 0
Where the indices would be '1 4 6 9 10 11 12'
Thanks
댓글 수: 0
채택된 답변
추가 답변 (1개)
  Jan
      
      
 2017년 2월 28일
        x = [0 0 0 1 1 0 0 0 1 0 1 0]
[B, N, Index] = RunLength(x)
Then B contains the unique values and Index the indices.
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


