MATLAB: How to get rid of repeating values inside an array

arrayMATLABrepeating values

I have a matrix
a=[1 2 3 3 4 4 5];
I want to get rid of values 3 and 4 as they are repeating so that the output becomes
b=[1 2 5]

Best Answer

b = a(sum(bsxfun(@eq,a,a'))==1)