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

8 ビュー (過去 30 日間)
Mike
Mike 2013 年 9 月 11 日
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 Center および File ExchangeGraphics Object Identification についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by