Effacer les filtres
Effacer les filtres

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

13 vues (au cours des 30 derniers jours)
Austin Bollinger
Austin Bollinger le 20 Déc 2021
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?

Réponse acceptée

Matt J
Matt J le 20 Déc 2021
Modifié(e) : Matt J le 20 Déc 2021
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

Plus de réponses (1)

David Hill
David Hill le 20 Déc 2021
x=sort(x);%make sure x is sorted
x(diff(x)<2)=[];

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by