How do I get the maximum value for x with its corresponding y value?

8 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Azzi Abdelmalek
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
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
Mike
Mike am 11 Sep. 2013
Thanks, original code wasn't working

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Object Identification 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!

Translated by