Home > bioelectromagnetism > eeg_load_difdata_script.m

eeg_load_difdata_script

PURPOSE ^

eeg_load_difdata_script - Script to load ERP difference waves

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 eeg_load_difdata_script - Script to load ERP difference waves
 Load data (680 rows x 124 cols)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % eeg_load_difdata_script - Script to load ERP difference waves
0002 % Load data (680 rows x 124 cols)
0003 eegpath = 'D:\data_emse\ptsdpet\link14hz\'; cd(eegpath);
0004 ext = '_link14hz';
0005 groups = {'c' 'p'};
0006 cond = {'tac_oac'};
0007 subs = [1:10];
0008 
0009 % Define sample rate & epoch parameters
0010 sample_rate = 2.5;
0011 epoch_start = -200;
0012 epoch_end = 1500;
0013 points = 681;
0014 timeArray = meshgrid(epoch_start:sample_rate:epoch_end,1)';
0015 timeNonZero = find(timeArray);
0016 timeZero = find(timeArray == 0);
0017 
0018 for g = 1:length(groups),
0019     for i=1:length(subs),
0020         for c=1:length(cond),
0021             
0022             % Load data
0023             file = sprintf('%s%s%02d%s%s.txt',eegpath,groups{g},subs(i),cond{c},ext);
0024             data = sprintf(  '%s%02d%s%s',            groups{g},subs(i),cond{c},ext);
0025             if ~exist(data,'var')
0026                 fprintf('loading %s\n',file);
0027                 load(file);
0028                 
0029                 
0030                 % Interpolate the Zero value, only useful for ascii from
0031                 % Neuroscan 3x or 4x AVG files
0032                 volt = eval(data);
0033                 InterpZero = interp1( timeArray(timeNonZero), volt, 0, 'cubic' );
0034                 volt = [volt(1:timeZero-1,:); InterpZero; volt(timeZero:end,:)];
0035                 eval(strcat(data,' = volt;'));
0036                 
0037                 
0038             else
0039                 fprintf('Already loaded %s\n',file);
0040                 % Save translated data file
0041                 
0042                 %dat = eval(data); dat = dat';
0043                 %file = sprintf('%s%s%02d%s%s.dat',eegpath,groups{g},subs(i),cond{c},ext);
0044                 %eeg_write_ascii(file,dat,'%12.4f');
0045             end
0046         end
0047     end
0048 end
0049 
0050 clear g i c file data timeNonZero volt InterpZero

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003