To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / _segmentation / mergenulls.m
History | View | Annotate | Download (810 Bytes)
| 1 |
function parts = mergenulls(parts) |
|---|---|
| 2 |
|
| 3 |
for iPart = 1:length(parts) |
| 4 |
newparts = []; |
| 5 |
if parts(iPart).letter == '-' |
| 6 |
parts(iPart).indices = sort(parts(iPart).indices); |
| 7 |
newpartind = 0; |
| 8 |
indices = [-1 parts(iPart).indices]; |
| 9 |
for iInd = 2:length(indices) |
| 10 |
if indices(iInd) - indices(iInd-1) > 1 |
| 11 |
newpartind = newpartind + 1; |
| 12 |
newparts(newpartind).letter = ['n' num2str(newpartind)]; |
| 13 |
newparts(newpartind).n = 1; |
| 14 |
newparts(newpartind).indices = indices(iInd); |
| 15 |
newparts(newpartind).level = 0; |
| 16 |
else |
| 17 |
newparts(newpartind).n = newparts(newpartind).n + 1; |
| 18 |
end |
| 19 |
end |
| 20 |
parts(iPart) = []; |
| 21 |
parts = [parts newparts]; |
| 22 |
end |
| 23 |
end |
| 24 |
|