Home > bioelectromagnetism > eeg_load_data_script.m

eeg_load_data_script

PURPOSE ^

eeg_load_data_script - load ERP data

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 eeg_load_data_script - load ERP data
 Load data (680 rows x 124 cols)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % eeg_load_data_script - load ERP data
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 %cond = {'tac_oac'};
0008 subs = [1:10];
0009 
0010 % Define sample rate & epoch parameters
0011 sample_rate = 2.5;
0012 epoch_start = -200;
0013 epoch_end = 1500;
0014 points = 681;
0015 timeArray = meshgrid(epoch_start:sample_rate:epoch_end,1)';
0016 timeNonZero = find(timeArray);
0017 timeZero = find(timeArray == 0);
0018 
0019 for g = 1:length(groups),
0020     for i=1:length(subs),
0021         for c=1:length(cond),
0022             
0023             % Load data
0024             file = sprintf('%s%s%02d%s%s.txt',eegpath,groups{g},subs(i),cond{c},ext);
0025             data = sprintf(  '%s%02d%s%s',            groups{g},subs(i),cond{c},ext);
0026             if ~exist(data,'var')
0027                 fprintf('loading %s\n',file);
0028                 load(file);
0029                 
0030                 % Interpolate the Zero value
0031                 volt = eval(data);
0032                 InterpZero = interp1( timeArray(timeNonZero), volt, 0, 'cubic' );
0033                 volt = [volt(1:timeZero-1,:); InterpZero; volt(timeZero:end,:)];
0034                 eval(strcat(data,' = volt;'))
0035                 
0036             else
0037                 %dat = eval(data); dat = dat';
0038                 %file = sprintf('%s%s%02d%s%s.dat',eegpath,groups{g},subs(i),cond{c},ext);
0039                 %eeg_write_ascii(file,dat,'%12.4f');
0040             end
0041         end
0042     end
0043 end
0044 
0045 clear g i c file data timeNonZero volt InterpZero

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