MATLAB: How to select highest three maximum values from each row of an matrix

matrix

A=rand(3,8) generates a matrix of 3 rows with 8 columns
could anyone help me how to select highest three maximum values from each row.

Best Answer

A=rand(3,8);
B = sort(A,2,'descend');
out = B(:,1:3);
Related Question