MATLAB Answers


Minimum Value Search

Asked by James
on 18 Jul 2011


I have a matrix size 200*200, which all store a set of numbers

I want to find the minimum value on each row of my matrix.

I want to end up with new 200*1 array which stores the column number where the minimum value for that row has been found.

I hope somebody can help!



No products are associated with this question.

1 Answer

Answer by Jan Simon
on 18 Jul 2011

x = rand(200, 200);
[value, index] = min(x, [], 2)

"help min" contains a corresponding example. Reading the help and doc text is always a good idea.


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!