|
|
|
[[_TOC_]]
|
|
|
|
|
|
|
|
# Introduction
|
|
|
|
This command allows getting markers as a struct array.
|
|
|
|
# Marker struct description
|
|
|
|
````matlab
|
|
|
|
Marker.label; % label of marker
|
|
|
|
Marker.position; % position in seconds.
|
|
|
|
Marker.duration; % duration in seconds.
|
|
|
|
Marker.value; % value associated with marker
|
|
|
|
Marker.targets; % cell array of strings. Labels of targeted channels. Empty if the marker is GLOBAL.
|
|
|
|
````
|
|
|
|
# Default usage
|
|
|
|
````matlab
|
|
|
|
function main(varargin)
|
|
|
|
anywave('init', varargin);
|
|
|
|
markers = anywave('get_markers');
|
|
|
|
````
|
|
|
|
This code will get ALL the markers loaded with the current data file.
|
|
|
|
# Add an extra parameter to the function
|
|
|
|
In order to specify constraints or requirements on the data we want to access to, the function allows an extra parameter which must be a struct.
|
|
|
|
|
|
|
|
# Get markers by their labels
|
|
|
|
````matlab
|
|
|
|
function main(varargin)
|
|
|
|
anywave('init', varargin);
|
|
|
|
cfg = [];
|
|
|
|
cfg.labels = {'seizure', 'EI' };
|
|
|
|
markers = anywave('get_markers', cfg);
|
|
|
|
if ~isempty(markers)
|
|
|
|
% process markers
|
|
|
|
end
|
|
|
|
````
|
|
|
|
This code will get all markers labeled *seizure* and *EI*.
|
|
|
|
|
|
|
|
# Get markers by values
|
|
|
|
````matlab
|
|
|
|
function main(varargin)
|
|
|
|
anywave('init', varargin);
|
|
|
|
cfg = [];
|
|
|
|
cfg.values = [10 5 512];
|
|
|
|
markers = anywave('get_markers', cfg);
|
|
|
|
if ~isempty(markers)
|
|
|
|
% process markers
|
|
|
|
end
|
|
|
|
````
|
|
|
|
This code will get all markers with a value of 10, 5 or 512.
|
|
|
|
|
|
|
|
# Get markers which target channels
|
|
|
|
````matlab
|
|
|
|
function main(varargin)
|
|
|
|
anywave('init', varargin);
|
|
|
|
cfg = [];
|
|
|
|
cfg.channels = {'A1', 'A3' }; % get markers targeting channel A1 and/or A3
|
|
|
|
markers = anywave('get_markers', cfg);
|
|
|
|
if ~isempty(markers)
|
|
|
|
% process markers
|
|
|
|
end
|
|
|
|
````
|
|
|
|
|
|
|
|
# Get only markers with a duration
|
|
|
|
This can be done by specifying options:
|
|
|
|
````matlab
|
|
|
|
function main(varargin)
|
|
|
|
anywave('init', varargin);
|
|
|
|
cfg = [];
|
|
|
|
cfg.options = {'with duration'};
|
|
|
|
markers = anywave('get_markers', cfg);
|
|
|
|
if ~isempty(markers)
|
|
|
|
% process markers
|
|
|
|
end
|
|
|
|
```` |
|
|
|
\ No newline at end of file |