Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,18 +1,23 @@
|
|||
function S=range_extraction(L)
|
||||
% Range extraction
|
||||
L(end+1) = NaN;
|
||||
S = int2str(L(1));
|
||||
k = 1;
|
||||
while (k < length(L)-1)
|
||||
if (L(k)+1==L(k+1) && L(k)+2==L(k+2) )
|
||||
m = 2;
|
||||
while (L(k)+m==L(k+m))
|
||||
m = m+1;
|
||||
end;
|
||||
k = k+m-1;
|
||||
S = [S,'-',int2str(L(k))];
|
||||
else
|
||||
k = k+1;
|
||||
S = [S,',',int2str(L(k))];
|
||||
end
|
||||
end;
|
||||
% Range extraction
|
||||
L(end+1) = NaN;
|
||||
S = int2str(L(1));
|
||||
k = 1;
|
||||
while (k < length(L)-1)
|
||||
if (L(k)+1==L(k+1) && L(k)+2==L(k+2) )
|
||||
m = 2;
|
||||
while (L(k)+m==L(k+m))
|
||||
m = m+1;
|
||||
end
|
||||
k = k+m-1;
|
||||
S = [S,'-',int2str(L(k))];
|
||||
else
|
||||
k = k+1;
|
||||
S = [S,',',int2str(L(k))];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
disp(range_extraction([0, 1, 2, 4, 6, 7, 8, 11, 12, 14, 15, ...
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, ...
|
||||
28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue