finding maximum value of a column

12 views (last 30 days)
so i have this matrix 193X2 where column 1 is the time and column 2 is cars counted i want to find THE TIME where the maximum car is counted can someone help me?

Accepted Answer

Walter Roberson
Walter Roberson on 19 Apr 2018
[~, idx] = max(YourMatrix(:,2));
THE_TIME = YourMatrix(idx,1);
  2 Comments
Tony Garcia
Tony Garcia on 20 Apr 2018
thanks for the solution.. it works, but can you explain me what does [~, idx] means?
Walter Roberson
Walter Roberson on 20 Apr 2018

That is the same as

[SomeVariableNotOtherwiseUsed, idx] = max(YourMatrix(:, 2))
clear SomeOtherwiseUnusedVariableName 

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!