%C=mCollapseArray(A).m
%collapses an array A containing several equal values into one (C) which 
%contains each of these values just once.

function C = mCollapseArray(A)

%B=zeros(1,length(A));
B=zeros(1,13); %For my purposes, the array values are between 1 and 13 (These are BP families)

A=sort(A);
B(1)=A(1);
count=1;
for i=2:length(A)
    if A(i)~=A(i-1)
        count=count+1;
        B(count)=A(i);
    end
end

count=0;
for i=1:length(B)
    if B(i)~=0
        count=count+1;
        C(count)=B(i);
    end
end
