필터 지우기
필터 지우기

Remove values from column that are close in value to each other

조회 수: 13 (최근 30일)
Austin Bollinger
Austin Bollinger 2021년 12월 20일
답변: David Hill 2021년 12월 20일
I have a column of values:
43
90
91
128
191
192
I would like to remove the values that are close to each other in value, but keep the highest value.
I would want the column to look like this:
43
91
128
192
Is this possible or should I rethink my way of doing this?

채택된 답변

Matt J
Matt J 2021년 12월 20일
편집: Matt J 2021년 12월 20일
One possibility:
x=[43
90
91
128
191
192];
[~,~,G]=uniquetol(x,10,'DataScale',1);
splitapply(@max,x,G)
ans = 4×1
43 91 128 192

추가 답변 (1개)

David Hill
David Hill 2021년 12월 20일
x=sort(x);%make sure x is sorted
x(diff(x)<2)=[];

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by