I have a cell type variable A with 500000 rows and 3 columns. See example below:
C1 C2 C3 C4 A={1994 'AACE' 2071 21998 'DFE' 7843 41999 'HC' 2071 41995 'JOP' 7843 41995 'IAC' 2071 2
I would like to sort this variable first by the C3 and then by C1. So I would have:
C1 C2 C3 C4 A={1994 'AACE' 2071 21995 'IAC' 2071 21999 'HC' 2071 41995 'JOP' 7843 41998 'DFE' 7843 4
I tried the follwoing code, but I am not being successful:
[~,i1]=sort(A(:,3)); %sort by column 3 A=A(i1,:);
[~,i1]=sort(A(:,1)); %sort by column 1 next A=A(i1,:);
Best Answer