MATLAB: Find minimum value greater than zero in the rows

find minimum value greater than zero in the rows

a=[9,32,7,0,0,0,0,0;15,32,9,0,0,0,0,0;25,42,0,0,0,0,0,0];i have to find out minimum value in 'a' which should be greater than zero.my answer has to be b=[7;9;25].suggest some points

Best Answer

a(a == 0) = inf;
b = min(a,[],2);