MATLAB: How do i refer to an entire row in a matrix, while only specifying one variable in that row

matrixminimumrow

I have a matrix consisting of 2 columns and 160 rows. My aim is to automatically generate the entire row in which the second variable is the lowest of it's column. For example:
Matrix = [1 5; 4 1; 2 7; 3 8]
I need a code which generates the second row (4 1) since 1 is the lowest number in the second column. Thank you in advance for the help!

Best Answer

Unfortunately, here's where Matlab syntax of only being able to return and use the first argument inline hurts (albeit I don't have a suggestion for an alternate syntax) so you must use an intermediate variable...
[~,ix]=min(M(:,2)); % loc of min in 2nd column
N=M(ix,:); % that row from M
This works reliably only if there is a unique minimum; if repeated minimums are possible the above will return only the location of the first of same...