Re: left adjusting the matrix with unique elements



monarc wrote:

< discussion of problem

you may turn to sort

% an example
A = [1900 1 0 2 0 3 ; 1901 0 0 0 0 1 ; 1902 1 2 3 0 4] ;

B = A(:,2:end) ;
B(B==0) = inf ;
B = sort(B,2) ; % sort each row
B(isinf(B)) = 0 ;
B = [A(:,1) B] ;

hth
Jos
.