MATLAB: How to get the indeces of the minimum value of each row in a matrix

MATLAB

E.g.
a = [1,2,3
4,5,6
2,1,3
4,4,3]
to return a matrix of
[1
1
2
3
]
? Thanks, new to Matlab

Best Answer

[Minval, idx] = min(a, [], 2)