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

请先登录,再进行评论。

更多回答(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