How do I get the maximum value for x with its corresponding y value?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have 2 columns of numbers. I want to find the maximum value of the numbers in the x column and it's corresponding y value. I am not sure how to put in the code. please help
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 11 Sep. 2013
Bearbeitet: Azzi Abdelmalek
am 11 Sep. 2013
Example
A=[1 2;3 4;47 20;5 55]
[xmax,idx]=max(A(:,1));
ymax=A(idx,2)
3 Kommentare
Azzi Abdelmalek
am 11 Sep. 2013
That's what my code do
A=[1 2;3 4;47 20;5 55];
[xmax,idx]=max(A(:,1));
ymax=A(idx,2);
xmax
ymax
% the result
xmax =
47
ymax =
20
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical 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!