How to get Unique values from two columns at a time?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
LISSA DUVVU
am 16 Feb. 2022
Bearbeitet: Stephen23
am 16 Feb. 2022
Hello,
I have a matrix
0.075278 0.213 18 127
0.075278 0.220 16 127
0.075278 0.248 31 129
0.075278 0.307 22 129
0.075278 0.323 14 129
0.241944 0.217 26 129
0.241944 0.223 14 129
0.241944 0.487 22 129
0.241944 0.677 16 129
12.82861 0.247 12 135
If column 1 and 4 have unique values i need to keep only one and have to remove remaining
I want my answer as
0.075278 0.220 16 127
0.075278 0.323 14 129
0.241944 0.677 16 129
12.82861 0.247 12 135
0 Kommentare
Akzeptierte Antwort
Stephen23
am 16 Feb. 2022
Bearbeitet: Stephen23
am 16 Feb. 2022
M = [0.075278,0.213,18,127;0.075278,0.220,16,127;0.075278,0.248,31,129;0.075278,0.307,22,129;0.075278,0.323,14,129;0.241944,0.217,26,129;0.241944,0.223,14,129;0.241944,0.487,22,129;0.241944,0.677,16,129;12.82861,0.247,12,135]
[~,X] = uniquetol(M(:,[1,4]),'highest','ByRows',true);
N = M(X,:)
5 Kommentare
Stephen23
am 16 Feb. 2022
Bearbeitet: Stephen23
am 16 Feb. 2022
@LISSA DUVVU: please show the exact code that you tried.
Please check the help for your installed MATLAB version. Check the syntaxes that it supports. It may be that you need to also supply the tol argument, or something similar.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Optimization Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!