view _segmentation/mergenulls.m @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
line wrap: on
line source
function parts = mergenulls(parts)

for iPart = 1:length(parts)
    newparts = [];
    if parts(iPart).letter == '-'
        parts(iPart).indices = sort(parts(iPart).indices);
        newpartind = 0;
        indices = [-1 parts(iPart).indices];
        for iInd = 2:length(indices)
            if indices(iInd) - indices(iInd-1) > 1
                newpartind = newpartind + 1;
                newparts(newpartind).letter = ['n' num2str(newpartind)];
                newparts(newpartind).n = 1;
                newparts(newpartind).indices = indices(iInd);
                newparts(newpartind).level = 0;                
            else
                newparts(newpartind).n = newparts(newpartind).n + 1;
            end
        end
        parts(iPart) = [];
        parts = [parts  newparts];
    end
end