Mercurial > hg > mauch-mirex-2010
annotate _segmentation/mergenulls.m @ 9:4ea6619cb3f5 tip
removed log files
author | matthiasm |
---|---|
date | Fri, 11 Apr 2014 15:55:11 +0100 |
parents | b5b38998ef3b |
children |
rev | line source |
---|---|
matthiasm@8 | 1 function parts = mergenulls(parts) |
matthiasm@8 | 2 |
matthiasm@8 | 3 for iPart = 1:length(parts) |
matthiasm@8 | 4 newparts = []; |
matthiasm@8 | 5 if parts(iPart).letter == '-' |
matthiasm@8 | 6 parts(iPart).indices = sort(parts(iPart).indices); |
matthiasm@8 | 7 newpartind = 0; |
matthiasm@8 | 8 indices = [-1 parts(iPart).indices]; |
matthiasm@8 | 9 for iInd = 2:length(indices) |
matthiasm@8 | 10 if indices(iInd) - indices(iInd-1) > 1 |
matthiasm@8 | 11 newpartind = newpartind + 1; |
matthiasm@8 | 12 newparts(newpartind).letter = ['n' num2str(newpartind)]; |
matthiasm@8 | 13 newparts(newpartind).n = 1; |
matthiasm@8 | 14 newparts(newpartind).indices = indices(iInd); |
matthiasm@8 | 15 newparts(newpartind).level = 0; |
matthiasm@8 | 16 else |
matthiasm@8 | 17 newparts(newpartind).n = newparts(newpartind).n + 1; |
matthiasm@8 | 18 end |
matthiasm@8 | 19 end |
matthiasm@8 | 20 parts(iPart) = []; |
matthiasm@8 | 21 parts = [parts newparts]; |
matthiasm@8 | 22 end |
matthiasm@8 | 23 end |
matthiasm@8 | 24 |