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

8 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 11 Set 2013
Modificato: Azzi Abdelmalek il 11 Set 2013
Example
A=[1 2;3 4;47 20;5 55]
[xmax,idx]=max(A(:,1));
ymax=A(idx,2)
  3 Commenti
Azzi Abdelmalek
Azzi Abdelmalek il 11 Set 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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Graphics Object Identification 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!

Translated by