Home > vbmeg > external > mne > mne_compensate_to.m

mne_compensate_to

PURPOSE ^

SYNOPSIS ^

function [newdata] = mne_compensate_to(data,to)

DESCRIPTION ^

 [newdata] = mne_compensate_to(data,to)

 Apply compensation to the data as desired

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [newdata] = mne_compensate_to(data,to)
0002 %
0003 % [newdata] = mne_compensate_to(data,to)
0004 %
0005 % Apply compensation to the data as desired
0006 %
0007 
0008 
0009 %
0010 %   Author : Matti Hamalainen, MGH Martinos Center
0011 %   License : BSD 3-clause
0012 %
0013 %
0014 %   Revision 1.4  2006/04/23 15:29:40  msh
0015 %   Added MGH to the copyright
0016 %
0017 %   Revision 1.3  2006/04/18 20:44:46  msh
0018 %   Added reading of forward solution.
0019 %   Use length instead of size when appropriate
0020 %
0021 %   Revision 1.2  2006/04/14 15:49:49  msh
0022 %   Improved the channel selection code and added ch_names to measurement info.
0023 %
0024 %   Revision 1.1  2006/04/12 10:51:19  msh
0025 %   Added projection writing and compensation routines
0026 %
0027 %
0028 
0029 me='MNE:mne_compensate_to';
0030 
0031 newdata = data;
0032 now     = mne_get_current_comp(newdata.info);
0033 %
0034 %   Are we there already?
0035 %
0036 if now == to
0037     fprintf(1,'Data are already compensated as desired\n');
0038 end
0039 %
0040 %   Make the compensator and apply it to all data sets
0041 %
0042 comp = mne_make_compensator(newdata.info,now,to);
0043 for k = 1:length(newdata.evoked)
0044    newdata.evoked(k).epochs = comp*newdata.evoked(k).epochs;
0045 end
0046 %
0047 %  Update the compensation info in the channel descriptors
0048 %
0049 newdata.info.chs = mne_set_current_comp(newdata.info.chs,to);
0050 return;
0051

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005