How do I get the maximum value for x with its corresponding y value?
1 回表示 (過去 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
0 件のコメント
採用された回答
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
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
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!