Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CRP Toolbox for MATLAB
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Norbert Marwan
CRP Toolbox for MATLAB
Commits
295a494a
Commit
295a494a
authored
16 years ago
by
marwan
Browse files
Options
Downloads
Patches
Plain Diff
fixed problem of empty RP
parent
5c2e8f1b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tt.m
+103
-83
103 additions, 83 deletions
tt.m
with
103 additions
and
83 deletions
tt.m
+
103
−
83
View file @
295a494a
...
@@ -23,6 +23,9 @@ function [a_out, b_out, c_out]=tt(x)
...
@@ -23,6 +23,9 @@ function [a_out, b_out, c_out]=tt(x)
% $Revision$
% $Revision$
%
%
% $Log$
% $Log$
% Revision 3.4 2007/12/20 16:26:57 marwan
% includes also white vertical lines
%
% Revision 3.3 2005/11/23 07:29:14 marwan
% Revision 3.3 2005/11/23 07:29:14 marwan
% help text updated
% help text updated
%
%
...
@@ -44,94 +47,111 @@ if nargout>3, error('Too many output arguments'), end
...
@@ -44,94 +47,111 @@ if nargout>3, error('Too many output arguments'), end
%a_out = NaN; b_out = NaN; c_out = NaN;
%a_out = NaN; b_out = NaN; c_out = NaN;
warning
off
warning
off
if
any
(
x
(:))
try
if
any
(
x
(:))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% for black vertical lines
xb
=
double
(
x
);
xb
(
end
+
1
,:)
=
0
;
xb
=
double
(
xb
(:));
z
=
diff
(
xb
);
z0
=
find
(
z
==
1
);
% begin of black sequence
z1
=
find
(
z
==-
1
);
% end of black sequence
% measure the length of black lines
if
z0
(
1
)
>
z1
(
1
)
z0
(
2
:
end
+
1
,
1
)
=
z0
(
1
:
end
);
z0
(
1
,
1
)
=
0
;
if
length
(
z0
)
>
length
(
z1
)
z0
(
end
)
=
[];
end
end
t
=
sort
(
z1
-
z0
);
t1
=
t
(
find
(
t
-
1
));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% for white vertical lines
for
i
=
1
:
size
(
x
,
2
)
i_
=
find
(
x
(:,
i
));
i1
=
min
(
i_
);
i2
=
max
(
i_
);
x
(
1
:
i1
,
i
)
=
1
;
x
(
i2
:
end
,
i
)
=
1
;
end
xw
=
double
(
x
);
xw
(
end
+
1
,:)
=
1
;
zw
=
diff
(
xw
(:));
z0w
=
find
(
zw
==-
1
);
% begin of white sequence
z1w
=
find
(
zw
==
1
);
% end of white sequence
% measure the length of white lines
if
z0w
(
1
)
>
z1w
(
1
)
z0w
(
1
)
=
[];
if
length
(
z1w
)
>
length
(
z0w
)
z1w
(
end
)
=
[];
end
end
if
length
(
z1w
)
>
length
(
z0w
)
z0w
=
[
1
;
z0w
];
end
tw
=
sort
(
z1w
-
z0w
);
t1w
=
tw
(
find
(
tw
-
1
));
if
nargout
==
3
c_out
=
zeros
(
length
(
tw
),
1
);
c_out
=
tw
;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if
nargout
>=
2
% for black vertical lines
b_out
=
zeros
(
length
(
t
),
1
);
xb
=
double
(
x
);
b_out
=
t
;
xb
(
end
+
1
,:)
=
0
;
xb
=
double
(
xb
(:));
end
z
=
diff
(
xb
);
z0
=
find
(
z
==
1
);
% begin of black sequence
z1
=
find
(
z
==-
1
);
% end of black sequence
% measure the length of black lines
if
nargout
>
0
if
z0
(
1
)
>
z1
(
1
)
if
isempty
(
t1
),
a_out
=
0
;
z0
(
2
:
end
+
1
)
=
z0
(
1
:
end
);
z0
(
1
)
=
0
;
else
,
a_out
=
mean
(
t1
);
if
length
(
z0
)
>
length
(
z1
)
end
z0
(
end
)
=
[];
else
mean
(
t1
)
end
else
if
nargout
==
3
c_out
=
NaN
;
end
if
nargout
>=
2
b_out
=
NaN
;
end
if
nargout
>
0
a_out
=
NaN
;
else
NaN
end
end
warning
on
catch
if
nargout
==
3
c_out
=
NaN
;
end
end
end
if
nargout
>=
2
t
=
sort
(
z1
-
z0
);
b_out
=
NaN
;
t1
=
t
(
find
(
t
-
1
));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% for white vertical lines
for
i
=
1
:
size
(
x
,
2
)
i_
=
find
(
x
(:,
i
));
i1
=
min
(
i_
);
i2
=
max
(
i_
);
x
(
1
:
i1
,
i
)
=
1
;
x
(
i2
:
end
,
i
)
=
1
;
end
xw
=
double
(
x
);
xw
(
end
+
1
,:)
=
1
;
zw
=
diff
(
xw
(:));
z0w
=
find
(
zw
==-
1
);
% begin of white sequence
z1w
=
find
(
zw
==
1
);
% end of white sequence
% measure the length of white lines
if
z0w
(
1
)
>
z1w
(
1
)
z0w
(
1
)
=
[];
if
length
(
z1w
)
>
length
(
z0w
)
z1w
(
end
)
=
[];
end
end
end
if
length
(
z1w
)
>
length
(
z0w
)
z0w
=
[
1
;
z0w
];
end
tw
=
sort
(
z1w
-
z0w
);
t1w
=
tw
(
find
(
tw
-
1
));
if
nargout
==
3
c_out
=
zeros
(
length
(
tw
),
1
);
c_out
=
tw
;
end
if
nargout
>=
2
b_out
=
zeros
(
length
(
t
),
1
);
b_out
=
t
;
end
if
nargout
>
0
if
isempty
(
t1
),
a_out
=
0
;
else
,
a_out
=
mean
(
t1
);
end
else
mean
(
t1
)
end
else
if
nargout
==
3
c_out
=
NaN
;
end
if
nargout
>=
2
b_out
=
NaN
;
end
if
nargout
>
0
a_out
=
NaN
;
else
NaN
end
if
nargout
>
0
a_out
=
NaN
;
else
NaN
end
end
end
warning
on
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment