How do convert array x to array z?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, How do convert array x to array z ?
x = [4 4 8 8 8 5 5 4 8 8 4]
Z = [1 1 2 2 2 3 3 1 2 2 1]
4 -> 1
8 -> 2
5 -> 3
댓글 수: 0
채택된 답변
추가 답변 (1개)
Andrei Bobrov
2018년 8월 28일
편집: Andrei Bobrov
2018년 8월 28일
or just:
[~,~,z] = unique(x,'stable');
or more
[~,z] = ismember(x,[4 8 5]);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!