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

조회 수: 8 (최근 30일)
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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 11일
편집: Azzi Abdelmalek 2013년 9월 11일
Example
A=[1 2;3 4;47 20;5 55]
[xmax,idx]=max(A(:,1));
ymax=A(idx,2)
  댓글 수: 3
Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 11일
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 2013년 9월 11일
Thanks, original code wasn't working

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Identification에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by