unique function but with repeated groups
조회 수: 2 (최근 30일)
이전 댓글 표시
I have= [1 1 1 5 5 5 1 1]
I want first indices of each repeat values: [1 4 7]
i.e., the first group of repeated 1's start at index 1, the second group of repeated 5's start at index 4 and the third group of repeated 1s start at index 7
I am trying unique function, but it misses out the last group of 1s.
[~,ic,~]=unique([1 1 1 5 5 5 1 1], 'stable')
gives me [1 4] and not [1 4 7]
댓글 수: 0
채택된 답변
추가 답변 (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!