Home > bioelectromagnetism > eeg_grand_mean_ascii_script.m

eeg_grand_mean_ascii_script

PURPOSE ^

eeg_grand_mean_ascii_script - generate grand mean ERP

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 eeg_grand_mean_ascii_script - generate grand mean ERP

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % eeg_grand_mean_ascii_script - generate grand mean ERP
0002 
0003 clear; close all;
0004 
0005 inpath  = 'd:\MyDocuments\emse_data\ptsd-pet\scd14hz\';
0006 outpath = 'd:\MyDocuments\emse_data\ptsd-pet\grand_mean\';
0007 
0008 file_ext = '_scd14hz.txt';
0009 bin_ext  = '_scd14hz.mat';
0010 
0011 format = '%12.4f ';
0012 
0013 groups = {'c' 'p'};
0014 subjects = {'01' '02' '03' '04' '05' '06' '07' '08' '09' '10'};
0015 conditions = {'o' 'oac' 'oat' 'ouc' 'out' 't' 'tac' 'tad' 'tat' 'tuc' 'tud' 'tut'};
0016 
0017 for c = 1:length(conditions)        cond = char(conditions(c));
0018     for g = 1:length(groups)        group = char(groups(g));
0019         for s = 1:length(subjects)  subj = strcat(group,char(subjects(s)));
0020 
0021             infile = strcat(inpath,subj,cond,file_ext);
0022             input = eeg_load_ascii(infile);
0023             
0024             if(s == 1)   add = zeros(size(input));
0025             else         add = add + input;
0026             end
0027         end
0028         
0029         avg = add / s;
0030         
0031         % output grand mean
0032         outfile = strcat(outpath,group,cond,file_ext);
0033         eeg_write_ascii(outfile,avg,format);
0034         
0035     end
0036 end

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