MATLAB: Unique Function based on 2 columns [Instead of rows]

cell arrayunique

Suppose, I have a cell array, a, with contents as such:
a{1}=[1 3 4 5;
3 3 4 5;
5 5 4 5
2 4 2 6;
6 5 2 6
7 2 3 1;]
How can I apply the 'unique' function on 2 columns [column 3 and 4] such that they will return the value '3' and '2'. [Since there are 3 duplicates for the pair 4,5 and 2 duplicates for the pair 2,6.]
Solution proposed:
diff(find([true; any(diff(a{1}(:,3:4)),2); true]))
———————————————————————–
However, when the arrangement of the contents is changed, for eg.
a{1}=[ 1 3 4 5;
3 3 2 6;
5 5 4 5
2 4 3 1;
6 5 2 6
7 2 3 1;]
The code doesn't seem to identify the similarity/duplicated for column 3 and 4 [Corresponding rows: 1 & 3; 2 & 5; 4 & 6]

Best Answer

b=a{1}
c=b(:,3:4)
[~,idx]=unique(c,'rows','first','stable')
out=b(idx,:)