MATLAB: How to get the maximum value for x with its corresponding y value

correspondinggraphmaxmaximumminminimumxy

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

Best Answer

  • Example
    A=[1 2;3 4;47 20;5 55]
    [xmax,idx]=max(A(:,1));
    ymax=A(idx,2)