[~,idx] = sort(mat(:,1));
sortedmat = mat(idx,:);
You can even do the same thing with unique to get the rows corresponding to unique values in the first column: [~,idu] = unique(mat(:,1))
uniquerows = mat(idu,:);
Note that unique has options for controlling the order of its outputs, and whether it takes the first or last matching element. You should check its documentation and pick the best options for you requirements.
Best Answer