How to simplify x and y coordinates or numbers
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Conner Carriere
il 7 Feb 2021
Commentato: Image Analyst
il 21 Feb 2021
I have multiple matrix with different x and y variables
Mr2 =
217.9198 394.7466
220.3522 288.1925
226.7584 194.7277
319.1827 396.4066
320.9901 293.0322
323.9730 194.6844
423.4146 297.8831
426.0054 399.2974
424.8713 198.3911
Mg3 =
257.5755 266.5336
259.3048 360.6109
256.0792 180.9467
351.4200 263.9756
350.5972 175.4610
356.0210 365.4651
440.5966 171.9462
444.4349 264.3318
453.3330 360.0456
I need to convert these to simpler numbers, while keeping the x and y values together
Looking at Mr2;
The three lowest values in the x column would be called 1, the three middle values would be called 2, the three highest values would be called 3.
This would work the same way in the y columns also.
The issue I am having, I am not able to find a way to do this, because the order changes, I will demonstrate the output below
Mr2 =
1 3
1 2
1 1
2 3
2 2
2 1
3 2
3 3
3 1
Mg3 =
1 2
1 3
1 1
2 2
2 1
2 3
3 1
3 2
3 3
Keep in mind that the values in the origional Mr2 and Mg3 are able to be changed, so they might have the lowest values in the 80s or the hightest in the 600's
let me know any ideas you may have, I am newer to matlab, so its a bit tough
0 Commenti
Risposta accettata
Image Analyst
il 7 Feb 2021
Try discretize():
Mr2 =[...
217.9198 394.7466
220.3522 288.1925
226.7584 194.7277
319.1827 396.4066
320.9901 293.0322
323.9730 194.6844
423.4146 297.8831
426.0054 399.2974
424.8713 198.3911]
Mg3 =[...
257.5755 266.5336
259.3048 360.6109
256.0792 180.9467
351.4200 263.9756
350.5972 175.4610
356.0210 365.4651
440.5966 171.9462
444.4349 264.3318
453.3330 360.0456]
Mr2 = discretize(Mr2, 3)
Mg3 = discretize(Mg3, 3)
2 Commenti
Image Analyst
il 21 Feb 2021
If passing in the number of levels doesn't split it up the way you like it, you can use the option where you pass in "edges" which are the dividing values between all the different levels that you'd like to use.
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!