Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MI_EEG_in_elderly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Julius Welzel
MI_EEG_in_elderly
Commits
9f629ca8
Commit
9f629ca8
authored
Mar 12, 2019
by
Julius Welzel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
5d9012df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
101_software/cont_area.m
101_software/cont_area.m
+50
-0
No files found.
101_software/cont_area.m
0 → 100644
View file @
9f629ca8
function
[
totalarea
ca
]
=
cont_area
(
C
,
Xgrid
,
Ygrid
,
Z_group
)
%cont_area Calculates area inside conture lines
% Extract the x- and y-locations from the contour matrix C.
ca
.
xL
=
C
(
1
,
:);
ca
.
yL
=
C
(
2
,
:);
% Interpolate on the first surface to find z-locations for the intersection
% line.
ca
.
zL
=
interp2
(
Xgrid
,
Ygrid
,
Z_group
,
ca
.
xL
,
ca
.
yL
);
%find curves
n
(
1
)
=
1
;
%n: indices where the certain curves start
d
(
1
)
=
C
(
2
,
1
);
%d: distance to the next index
ii
=
1
;
while
true
n
(
ii
+
1
)
=
n
(
ii
)
+
d
(
ii
)
+
1
;
%calculate index of next startpoint
if
n
(
ii
+
1
)
>
numel
(
ca
.
xL
)
%breaking condition
n
(
end
)
=
[];
%delete breaking point
break
end
d
(
ii
+
1
)
=
ca
.
yL
(
n
(
ii
+
1
));
%get next distance
ii
=
ii
+
1
;
end
%which contourlevel to calculate?
value
=
0
;
%must be member of clevels
sel
=
find
(
ismember
(
ca
.
xL
(
n
),
value
));
idx
=
n
(
sel
);
%indices belonging to choice
L
=
ca
.
yL
(
n
(
sel
)
);
%length of curve array
% calculate area and plot all contours of the same level
for
ii
=
1
:
numel
(
idx
)
x
{
ii
}
=
ca
.
xL
(
idx
(
ii
)
+
1
:
idx
(
ii
)
+
L
(
ii
));
y
{
ii
}
=
ca
.
yL
(
idx
(
ii
)
+
1
:
idx
(
ii
)
+
L
(
ii
));
%partial areas of all contours of the same plot
areas
(
ii
)
=
polyarea
(
x
{
ii
},
y
{
ii
});
end
% calculate total area of all contours of same level
totalarea
=
sum
(
areas
);
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment