function edges = find_edges (x)
j = 1;
for i = 1:(length (x) - 1)
    if x(i) ~= x(i+1)
        edges (j) = i;
        j = j+1;
    end
end