MATLAB: How to delete repated rows with out re order them

delete repeated rows with out re ordeing

Hi all,
I have this cells arrays:
levelx=
'GO:0016787' 'GO:0006412' 'GO:0030533'
'GO:0008150' 'GO:0006412' 'GO:0030533'
'GO:0006810' 'GO:0006412' 'GO:0030533'
'GO:0016787' 'GO:0006412' 'GO:0030533'
'GO:0008150' 'GO:0006412' 'GO:0030533'
'GO:0006810' 'GO:0006412' 'GO:0030533'
'GO:0016787' 'GO:0006412' 'GO:0030533'
'GO:0008150' 'GO:0006412' 'GO:0030533'
'GO:0006810' 'GO:0006412' 'GO:0030533'
'GO:0016787' 'GO:0006412' 'GO:0030533'
I need to delete the repeated rows but without changing the order of the whole rows… note that I used a code that find te unique rows but it change the order of the rows:
[~,idx]=unique(cell2mat(levelx),'rows');
unique_levelx = levelx(idx,:);

Best Answer

[~,idx]=unique(cell2mat(levelx),'rows','first');
unique_levelx = levelx(sort(idx),:);