Commit dd087817 authored by mikeCplus's avatar mikeCplus
Browse files

help function descriptions added and updated

parent df341a09
......@@ -45,23 +45,6 @@
%
% Code written by James A. Desjardins, Allan Campopiano, and Andrew Lofts
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program (LICENSE.txt file in the root directory); if not,
% write to the Free Software Foundation, Inc., 59 Temple Place,
% Suite 330, Boston, MA 02111-1307 USA
function version = eegplugin_vised_marks(fig, try_strings, catch_strings)
......
......@@ -39,20 +39,6 @@
% Authors: Hilit Serby, Arnaud Delorme & Scott Makeig, SCCN/INC/UCSD, Sep 02, 2005
% Copyright (C) Hilit Serby, SCCN, INC, UCSD, Sep 02, 2005, hilit@sccn.ucsd.edu
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
function EEG = marks_eeg_regepochs(EEG, varargin)
......@@ -68,9 +54,9 @@ end;
% test input variables
% --------------------
if ~isstruct(EEG) || ~isfield(EEG,'event')
error('first argument must be an EEG structure')
error('first argument must be an EEG structure')
elseif EEG.trials > 1
error('input dataset must be continuous data (1 epoch)');
error('input dataset must be continuous data (1 epoch)');
end
if nargin > 1 && ~ischar(varargin{1})
......@@ -89,15 +75,15 @@ g = finputcheck(options, { 'recurrence' 'real' [] 1;
if ischar(g), error(g); end;
if g.recurrence < 0 || g.recurrence > EEG.xmax
error('recurrence_interval out of bounds');
error('recurrence_interval out of bounds');
end
if nargin < 3
g.limits = [0 g.recurrence];
g.limits = [0 g.recurrence];
end
if length(g.limits) ~= 2 || g.limits(2) <= g.limits(1)
error('epoch limits must be a 2-vector [minsec maxsec]')
error('epoch limits must be a 2-vector [minsec maxsec]')
end
% calculate number of events to add
......@@ -111,7 +97,7 @@ nu = floor(en / (g.recurrence * EEG.srate)); % number of type 'X' events to add
% nu = length((bg+g.recurrence):g.recurrence:(en-g.recurrence)); % number of 'X' events, one every 'g.recurrence' sec
if nu < 1
error('specified recurrence_interval too long')
error('specified recurrence_interval too long')
end
% print info on commandline
......@@ -131,14 +117,14 @@ end
nurevents = length(EEG.urevent);
for k = 1:nu
if rem(k, 40)
fprintf('.')
else
fprintf('%d',k)
end
if k == 40 || ( k > 40 && ~rem(k - 40, 70))
fprintf('\n');
end
if rem(k, 40)
fprintf('.')
else
fprintf('%d',k)
end
if k == 40 || ( k > 40 && ~rem(k - 40, 70))
fprintf('\n');
end
EEG.event(nevents + k).type = g.eventtype;
EEG.event(nevents + k).latency = round(g.recurrence * (k-1) * EEG.srate + 1);
......
......@@ -46,33 +46,19 @@
% began {default: 'yes'}
%
% Outputs:
% OUTEEG - output dataset
% OUTEEG - output dataset
% indices - indices of accepted events
%
% Authors: Arnaud Delorme and Hilit Serby, SCCN, INC, UCSD, 2001
%
% See also: eeglab, epoch
% See also: eeglab, epoch()
% deprecated
% 'timeunit' - Time unit ['seconds'|'points'] If 'seconds,' consider events
% times to be in seconds. If 'points,' consider events as
% indices into the data array. {default: 'points'}
% Copyright (C) 2001 Arnaud Delorme, Salk Institute, arno@salk.edu
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
% Authors: Hilit Serby, Arnaud Delorme & Scott Makeig, SCCN/INC/UCSD, Sep 02, 2005
% Copyright (C) Hilit Serby, SCCN, INC, UCSD, Sep 02, 2005, hilit@sccn.ucsd.edu
% 01-25-02 reformated help & license -ad
% 02-13-02 introduction of 'key', val arguments -ad
......@@ -83,7 +69,7 @@
function [EEG, indices, com] = marks_pop_epoch( EEG, events, lim, varargin );
if nargin < 1
help pop_epoch;
help pop_epoch;
return;
end;
com = '';
......@@ -105,20 +91,20 @@ if isempty(EEG.event)
end;
if ~isfield(EEG.event, 'latency'),
disp( 'Absent latency field in event array/structure: must name one of the fields ''latency''');
beep; return;
beep; return;
end;
OLDEEG = EEG;
if nargin < 3
% popup window parameters
% -----------------------
promptstr = { strvcat('Time-locking event type(s) ([]=all):', ...
promptstr = { strvcat('Time-locking event type(s) ([]=all):', ...
'Select ''Edit > Event values'' to see type values.'), ...
'Epoch limits [start, end] in seconds:', ...
'Name for the new dataset:', ...
'Out-of-bounds EEG rejection limits ([min max], []=none):' };
cbevent = ['if ~isfield(EEG.event, ''type'')' ...
cbevent = ['if ~isfield(EEG.event, ''type'')' ...
' errordlg2(''No type field'');' ...
'else' ...
' tmpevent = EEG.event;' ...
......@@ -133,27 +119,27 @@ if nargin < 3
'end;' ...
'clear tmps tmpevent tmpv tmpstr tmpfieldnames;' ];
geometry = { [2 1 0.5] [2 1 0.5] [2 1.5] [2 1 0.5] };
uilist = { { 'style' 'text' 'string' 'Time-locking event type(s) ([]=all)' } ...
{ 'style' 'edit' 'string' '' 'tag' 'events' } ...
{ 'style' 'pushbutton' 'string' '...' 'callback' cbevent } ...
{ 'style' 'text' 'string' 'Epoch limits [start, end] in seconds' } ...
{ 'style' 'edit' 'string' '-1 2' } ...
{ } ...
{ 'style' 'text' 'string' 'Name for the new dataset' } ...
{ 'style' 'edit' 'string' fastif(isempty(EEG.setname), '', [ EEG.setname ' epochs' ]) } ...
{ 'style' 'text' 'string' 'Out-of-bounds EEG limits if any [min max]' } ...
{ 'style' 'edit' 'string' '' } { } };
geometry = { [2 1 0.5] [2 1 0.5] [2 1.5] [2 1 0.5] };
uilist = { { 'style' 'text' 'string' 'Time-locking event type(s) ([]=all)' } ...
{ 'style' 'edit' 'string' '' 'tag' 'events' } ...
{ 'style' 'pushbutton' 'string' '...' 'callback' cbevent } ...
{ 'style' 'text' 'string' 'Epoch limits [start, end] in seconds' } ...
{ 'style' 'edit' 'string' '-1 2' } ...
{ } ...
{ 'style' 'text' 'string' 'Name for the new dataset' } ...
{ 'style' 'edit' 'string' fastif(isempty(EEG.setname), '', [ EEG.setname ' epochs' ]) } ...
{ 'style' 'text' 'string' 'Out-of-bounds EEG limits if any [min max]' } ...
{ 'style' 'edit' 'string' '' } { } };
result = inputgui( geometry, uilist, 'pophelp(''pop_epoch'')', 'Extract data epochs - pop_epoch()');
if length(result) == 0 return; end;
result = inputgui( geometry, uilist, 'pophelp(''pop_epoch'')', 'Extract data epochs - pop_epoch()');
if length(result) == 0 return; end;
if strcmpi(result{1}, '[]'), result{1} = ''; end;
if ~isempty(result{1})
if strcmpi(result{1}(1),'''') % If event type appears to be in single-quotes, use comma
if strcmpi(result{1}, '[]'), result{1} = ''; end;
if ~isempty(result{1})
if strcmpi(result{1}(1),'''') % If event type appears to be in single-quotes, use comma
% and single-quote as delimiter between event types. toby 2.24.2006
% fixed Arnaud May 2006
events = eval( [ '{' result{1} '}' ] );
events = eval( [ '{' result{1} '}' ] );
else events = parsetxt( result{1});
end;
else events = {};
......@@ -172,8 +158,8 @@ end;
% create structure
% ----------------
if ~isempty(args)
try, g = struct(args{:});
catch, disp('pop_epoch(): wrong syntax in function arguments'); return; end;
try, g = struct(args{:});
catch, disp('pop_epoch(): wrong syntax in function arguments'); return; end;
else
g = [];
end;
......@@ -230,7 +216,7 @@ Ievent = sort(Ievent);
alllatencies = tmpeventlatency(Ievent);
if isempty(alllatencies)
error('pop_epoch(): empty epoch range (no epochs were found).'); return;
error('pop_epoch(): empty epoch range (no epochs were found).'); return;
end;
fprintf('pop_epoch():%d epochs selected\n', length(alllatencies));
......@@ -252,7 +238,6 @@ try
return;
else
disp('AMICA probabilities not compatible with size of data, model probabilities cannot be epoched...')
end
end
end
......@@ -266,45 +251,45 @@ end
% ------------------------------------------------------------------------------
tmpevents = EEG.event;
if lim(1) > 0 && ischar(EEG.event(1).type)
% go through all onset latencies
for Z1 = length(alllatencies):-1:1
% if there is any event in between trigger and epoch onset which are boundary events
selEvt = find([tmpevents.latency] > alllatencies(Z1) & [tmpevents.latency] < alllatencies(Z1) + lim(1) * EEG.srate);
selEvt = selEvt(strcmp({tmpevents(selEvt).type}, 'boundary'));
if any(selEvt)
if sum([tmpevents(selEvt).duration]) > lim(1) * EEG.srate
alllatencies(Z1) = [];
else
% correct the latencies by the duration of the data that were cutout
alllatencies(Z1) = alllatencies(Z1) - sum([tmpevents(selEvt).duration]);
end;
end
end
% go through all onset latencies
for Z1 = length(alllatencies):-1:1
% if there is any event in between trigger and epoch onset which are boundary events
selEvt = find([tmpevents.latency] > alllatencies(Z1) & [tmpevents.latency] < alllatencies(Z1) + lim(1) * EEG.srate);
selEvt = selEvt(strcmp({tmpevents(selEvt).type}, 'boundary'));
if any(selEvt)
if sum([tmpevents(selEvt).duration]) > lim(1) * EEG.srate
alllatencies(Z1) = [];
else
% correct the latencies by the duration of the data that were cutout
alllatencies(Z1) = alllatencies(Z1) - sum([tmpevents(selEvt).duration]);
end;
end
end
end
if lim(2) < 0 && ischar(EEG.event(1).type)
% go through all onset latencies
for Z1 = length(alllatencies):-1:1
% if there is any event in between trigger and epoch onset which are boundary events
selEvt = find([tmpevents.latency] < alllatencies(Z1) & [tmpevents.latency] > alllatencies(Z1) + lim(2) * EEG.srate);
selEvt = selEvt(strcmp({tmpevents(selEvt).type}, 'boundary'));
if any(selEvt)
if sum([tmpevents(selEvt).duration]) > -lim(2) * EEG.srate
alllatencies(Z1) = [];
else
% correct the latencies by the duration of the data that were cutout
alllatencies(Z1) = alllatencies(Z1) + sum([tmpevents(selEvt).duration]);
end;
end
end
% go through all onset latencies
for Z1 = length(alllatencies):-1:1
% if there is any event in between trigger and epoch onset which are boundary events
selEvt = find([tmpevents.latency] < alllatencies(Z1) & [tmpevents.latency] > alllatencies(Z1) + lim(2) * EEG.srate);
selEvt = selEvt(strcmp({tmpevents(selEvt).type}, 'boundary'));
if any(selEvt)
if sum([tmpevents(selEvt).duration]) > -lim(2) * EEG.srate
alllatencies(Z1) = [];
else
% correct the latencies by the duration of the data that were cutout
alllatencies(Z1) = alllatencies(Z1) + sum([tmpevents(selEvt).duration]);
end;
end
end
end
% select event time format and epoch
% ----------------------------------
switch lower( g.timeunit )
case 'points', [EEG.data tmptime indices epochevent tmp reallim]= epoch(EEG.data, alllatencies, [lim(1) lim(2)]*EEG.srate, ...
case 'points', [EEG.data tmptime indices epochevent tmp reallim]= epoch(EEG.data, alllatencies, [lim(1) lim(2)]*EEG.srate, ...
'valuelim', g.valuelim, 'allevents', tmpeventlatency);
tmptime = tmptime/EEG.srate;
case 'seconds', [EEG.data tmptime indices epochevent tmp reallim]= epoch(EEG.data, alllatencies, lim, 'valuelim', g.valuelim, ...
tmptime = tmptime/EEG.srate;
case 'seconds', [EEG.data tmptime indices epochevent tmp reallim]= epoch(EEG.data, alllatencies, lim, 'valuelim', g.valuelim, ...
'srate', EEG.srate, 'allevents', tmpeventlatency);
otherwise, disp('pop_epoch(): invalid event time format'); beep; return;
end;
......
% marks_add_label() - Add a new mark for the specified mark info type.
%
% Usage:
% >> EEGout = marks_add_label(EEG.marks,'time_info',{'new_time_flag',[1,0,0],time_flags});
%
% Required input:
% EEG.marks - EEG marks structure.
% info_type - type of mark ('time_info', 'chan_info', or 'comp_info')
% mark_prop - cell array of {label,color,flags}
%
% Outputs:
% EEG.marks - the updated EEG.marks structure.
%
% See also: marks_init();
%
% Code initially designed and written by James A. Desjardins (SHARCNET) with contributions from
% Andrew Lofts, Allan Campopiano, Brad Kennedy, Mike Cichonski, Tyler K. Collins, and Sara Stephenson
% supported by NSERC to Sidney J. Segalowitz at the Jack and Nora Walker Centre
% for Lifespan Development Research (Brock University),
% Brain Canada funding to Alan C. Evans at the Montreal Neurological Institute and Hospital (McGill University),
% and a Dedicated Programming award from SHARCNET, Compute Ontario.
% Copyright (C) 2017 James Desjardins
function marks_struct = marks_add_label(marks_struct,info_type,mark_prop)
if isempty(marks_struct)
......@@ -79,4 +103,4 @@ switch info_type
otherwise
disp('check field string...');
end
\ No newline at end of file
end
% marks_init() - Initialize the EEG.marks structure if it doesn't exist yet. It creates a
% field for time_info, chan_info, and comp_info with nothing initially flagged.
%
% Usage:
% >> EEGout = marks_init(size(EEG.data)); % default if no ICA has been performed on the data
% >> EEGout = marks_init(size(EEG.data),min(size(EEG.icaweights))); % if ICA had been performed
%
% Required input:
% datasize - the size of EEG.data.
%
% Optional input:
% 'ncomps' - the number of components extracted by the ICA decomposition.
%
% Outputs:
% EEG.marks - the newly created EEG.marks structure.
%
% See also: marks_add_label();
%
% Code initially designed and written by James A. Desjardins (SHARCNET) with contributions from
% Andrew Lofts, Allan Campopiano, Brad Kennedy, Mike Cichonski, Tyler K. Collins, and Sara Stephenson
% supported by NSERC to Sidney J. Segalowitz at the Jack and Nora Walker Centre
% for Lifespan Development Research (Brock University),
% Brain Canada funding to Alan C. Evans at the Montreal Neurological Institute and Hospital (McGill University),
% and a Dedicated Programming award from SHARCNET, Compute Ontario.
% Copyright (C) 2017 James Desjardins
function marks_struct = marks_init(datasize,ncomps)
disp('Building initial marks structure...');
......@@ -16,4 +44,4 @@ marks_struct=[];
marks_struct=marks_add_label(marks_struct,'comp_info',{'manual',[.7,.7,.7],[.7,.7,.7],-1,[]});
end
%end
\ No newline at end of file
% ADAPTED FROM eeg_regepochs()
% See also: pop_editeventvals(), pop_epoch(), rmbase();
%
% Authors: Hilit Serby, Arnaud Delorme & Scott Makeig, SCCN/INC/UCSD, Sep 02, 2005
% Copyright (C) Hilit Serby, SCCN, INC, UCSD, Sep 02, 2005, hilit@sccn.ucsd.edu
% marks_continuous2epochs() - Convert a continuous dataset into consecutive epochs of
% a specified regular length by adding dummy events of type
% and epoch the data around these events. Alternatively
% only insert events for extracting these epochs.
% May be used to split up continuous data for
% artifact rejection followed by ICA decomposition.
% The computed EEG.icaweights and EEG.icasphere matrices
% may then be exported to the continuous dataset and/or
% to its epoched descendents.
% Usage:
% >> EEGout = marks_continuous2epochs(EEG); % use defaults
% >> EEGout = marks_continuous2epochs(EEG, 'key', val, ...);
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
% Required input:
% EEG - EEG continuous data structure (EEG.trials = 1)
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
% Optional inputs:
% 'recurrence' - [in s] the regular recurrence interval of the dummy
% events used as time-locking events for the
% consecutive epochs {default: 1 s}
% 'limits' - [minsec maxsec] latencies relative to the time-locking
% events to use as epoch boundaries. Stated epoch length
% will be reduced by one data point to avoid overlaps
% {default: [0 recurrence_interval]}
% 'rmbase' - [NaN|latency] remove baseline (s). NaN does not remove
% baseline. 0 remove the pre-0 baseline. To
% remove the full epoch baseline, enter a value
% larger than the upper epoch limit. Default is 0.
% 'eventtype' - [string] name for the event type. Default is 'X'
% 'extractepochs' - ['on'|'off'] extract data epochs ('on') or simply
% insert events ('off'). Default is 'on'.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
% Outputs:
% EEGout - the input EEG structure separated into consecutive epochs.
%
% See also: pop_editeventvals(), pop_epoch(), rmbase();
%
% Code initially designed and written by James A. Desjardins (SHARCNET) with contributions from
% Andrew Lofts, Allan Campopiano, Brad Kennedy, Mike Cichonski, Tyler K. Collins, and Sara Stephenson
% supported by NSERC to Sidney J. Segalowitz at the Jack and Nora Walker Centre
% for Lifespan Development Research (Brock University),
% Brain Canada funding to Alan C. Evans at the Montreal Neurological Institute and Hospital (McGill University),
% and a Dedicated Programming award from SHARCNET, Compute Ontario.
% Copyright (C) 2017 James Desjardins
function [EEG] = marks_continuous2epochs(EEG, varargin)
......
% marks_epochs2continuous() - Concatenate a windowed dataset (EEG.trials > 1) back into a continuous dataset.
%
% Usage:
% >> EEGout = marks_epochs2continuous(EEG);
%
% Required input:
% EEG - EEG windowed data structure (EEG.trials > 1)
%
% Outputs:
% EEGout - the input EEG structure concatenated back into a single continuous epoch.
%
% See also: pop_editeventvals(), pop_epoch(), rmbase();
%
% Code initially designed and written by James A. Desjardins (SHARCNET) with contributions from
% Andrew Lofts, Allan Campopiano, Brad Kennedy, Mike Cichonski, Tyler K. Collins, and Sara Stephenson
% supported by NSERC to Sidney J. Segalowitz at the Jack and Nora Walker Centre
% for Lifespan Development Research (Brock University),
% Brain Canada funding to Alan C. Evans at the Montreal Neurological Institute and Hospital (McGill University),
% and a Dedicated Programming award from SHARCNET, Compute Ontario.
% Copyright (C) 2017 James Desjardins
function EEG=marks_epochs2continuous(EEG)
evtcount=0;
......@@ -166,4 +190,4 @@ if isfield(EEG,'marks');
EEG=marks_moveflags(EEG,2);
end
EEG=eeg_checkset(EEG);
\ No newline at end of file
EEG=eeg_checkset(EEG);
% chan_neighbour_r() - Find channels with an unusually high correlation (bridged)
% or an unusually low correlation (low_r) to a specified number
% of neighbouring channels, given a specific set of criteria.
%
% Usage:
% >> [EEG,m_neighbr_r,chandist,y,chan_win_sd] = chan_neighbour_r(EEG, ...
% [n_nbr_ch],'max', ...
% 'chan_inds',chan_inds, ...
% 'epoch_inds',epoch_inds, ...
% 'plot_figs','off');
%
% Required input:
% EEG - EEG continuous data structure (EEG.trials = 1)
% nneigbr - number of neighbouring channels to correlate to.
% method - ['max'|'mean'|'trimmean']
%
% Optional inputs:
% 'chan_inds' - the indices of the channels on which to calculate the variance.
% The default is all the channels or components.
% 'epoch inds' - the indices of the time points on which to calculate the variance.
% The default is all the time points.
% 'plot_figs' - Set to 'on' to plot a figure representing the channel variance (default: 'off').
%
% Outputs:
% EEG - the updated EEG data structure.
% m_neighbr_r - nearest neighbor r values depending on method specified as input.
% chandist - X,Y,Z distances from each neighbouring channel.
% y - indices of sorted channel distances.
% chan_win_sd - array of channel standard deviations.
%
% See also: marks_array2flags(), chan_neighbour_r(), fisherz();
%
% Code initially designed and written by James A. Desjardins (SHARCNET) with contributions from
% Andrew Lofts, Allan Campopiano, Brad Kennedy, Mike Cichonski, Tyler K. Collins, and Sara Stephenson
% supported by NSERC to Sidney J. Segalowitz at the Jack and Nora Walker Centre
% for Lifespan Development Research (Brock University),
% Brain Canada funding to Alan C. Evans at the Montreal Neurological Institute and Hospital (McGill University),
% and a Dedicated Programming award from SHARCNET, Compute Ontario.
% Copyright (C) 2017 James Desjardins
function [EEG,m_neigbr_r,chandist,y,chan_win_sd]=chan_neighbour_r(EEG,nneigbr,method,varargin)
g=struct(varargin{:});
......@@ -83,4 +126,4 @@ switch(method);
m_neigbr_r=trimmean(abs(c_neigbr_r),20,3);
end
chan_win_sd=squeeze(std(EEG.data,[],2));
\ No newline at end of file
chan_win_sd=squeeze(std(EEG.data,[],2));
% chan_variance() - Returns an array of variance values for each channel. The variance
% measure could be the standard deviation (default), the absolute distance
% from the mean, or the deviation from the mean of the spectral distribution.
%
% Usage:
% >> [EEG,data_sd]=chan_variance(EEG,'data_field','data','chan_inds',chan_inds,'epoch_inds',epoch_inds,'plot_figs','off');
%
% Required input:
% EEG - EEG continuous data structure (EEG.trials = 1)
%
% Optional inputs:
% 'data_field' - this is either 'data' (default) or 'icaact', depending on
% whether we want the variance of the scalp channels or the
% the variance of the independent components.
% 'chan_inds' - the indices of the channels on which to calculate the variance.
% The default is all the channels or components.
% 'epoch inds' - the indices of the time points on which to calculate the variance.
% The default is all the time points.
% 'plot_figs' - Set to 'on' to plot a figure representing the channel variance (default: 'off').
% 'varmeasure' - The variance measure to use. This can be either 'sd', 'absmean', or 'spect' (default: 'sd')
% 'detrend' - Detrend the data before calculating the variance (default: 'off').
% 'spectrange' - The frequency range of the spectrum to be considered if 'spect' option chosen as the varmeasure.
%
% Outputs:
% data_sd - the resulting array of variance values.
%
% See also: marks_array2flags(), chan_neighbour_r(), fisherz();
%
% Authors: Hilit Serby, Arnaud Delorme & Scott Makeig, SCCN/INC/UCSD, Sep 02, 2005
% Copyright (C) Hilit Serby, SCCN, INC, UCSD, Sep 02, 2005, hilit@sccn.ucsd.edu
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
function [EEG,data_sd]=chan_variance(EEG,varargin)
g=struct(varargin{:});
......@@ -51,4 +98,4 @@ if strcmp(g.plot_figs,'on');
figure;surf(double(data_sd),'LineStyle','none');