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