Line | |
---|
1 | %subseq_longest Find the longest continuous subsequences in columns of MM. |
---|
2 | % |
---|
3 | % Put the initial image of the longest continuous subsequence of known |
---|
4 | % points in column ``p'' to ``b(p)''. |
---|
5 | % |
---|
6 | % [b, len] = subseq_longest(I) |
---|
7 | % |
---|
8 | % Parameters: |
---|
9 | % len ... len(p) is length of the longest continuous |
---|
10 | % subsequence of known points in column ``p'' |
---|
11 | |
---|
12 | function [b, len] = subseq_longest(I) |
---|
13 | |
---|
14 | [m n] = size(I); |
---|
15 | |
---|
16 | b(n) = 0; % memory allocation |
---|
17 | len(n) = 0; % " " |
---|
18 | |
---|
19 | for p = 1:n |
---|
20 | seq(1:m) = 0; |
---|
21 | l = 1; |
---|
22 | for i = 1:m |
---|
23 | if I(i,p) |
---|
24 | seq(l) = seq(l) +1; |
---|
25 | else |
---|
26 | l = i+1; |
---|
27 | end |
---|
28 | end |
---|
29 | len(p) = max(seq); |
---|
30 | best = find(seq == len(p)); |
---|
31 | b(p) = best(1); |
---|
32 | end |
---|
33 | |
---|
34 | %b(:) = 1; % debug |
---|
Note: See
TracBrowser
for help on using the repository browser.