Remove repeating variables and replacing them

조회 수: 3 (최근 30일)
AA
AA 2020년 8월 22일
편집: Walter Roberson 2020년 8월 22일
Ex: In the array
x=[4 4 5 5 1 2 2 3 3 3 4 5]
, i want to eliminate all repeating elements and retain non-repeating elements
(4, 5,1,2,3,4,5)
i.e., If
x=[4 4 5 5 1 2 2 3 3 3 4 5]
, answer should be
x=[4 5 1 2 3 4 5]

채택된 답변

Bruno Luong
Bruno Luong 2020년 8월 22일
x = x([true diff(x)~=0])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by