Home > bioelectromagnetism > plots_loaddata.m

plots_loaddata

PURPOSE ^

plots_loaddata - script to load and plot ERPs

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 plots_loaddata - script to load and plot ERPs

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 % plots_loaddata - script to load and plot ERPs
0003 
0004 cd(data);
0005 
0006 datapath = pwd;
0007 
0008 % Load the averaged data
0009 sample_rate = 2.5;
0010 epoch_start = -200;
0011 epoch_end = 1500;
0012 points = 681;
0013 
0014 % --- Setup data structures for timing array
0015 
0016 timeArray = meshgrid(epoch_start:sample_rate:epoch_end,1)';
0017 timeNonZero = find(timeArray);
0018 timeZero = find(timeArray == 0);
0019 
0020 % Load data
0021 for g = {'c','p'},
0022     
0023     if strcmp(g,'c'),
0024         CONT.expfile = sprintf('%s%s%s%s.txt',char(g),exp,'_',data);
0025         CONT.expvolt = sprintf('%s%s%s%s',    char(g),exp,'_',data);
0026         CONT.confile = sprintf('%s%s%s%s.txt',char(g),con,'_',data);
0027         CONT.convolt = sprintf('%s%s%s%s',    char(g),con,'_',data);
0028         
0029         CONT.diffile = sprintf('%s%s%s%s%s%s.txt',char(g),exp,'-',con,'_',data);
0030         CONT.difvolt = sprintf('%s%s%s%s%s%s',    char(g),exp,'_',con,'_',data);
0031     else
0032         PTSD.expfile = sprintf('%s%s%s%s.txt',char(g),exp,'_',data);
0033         PTSD.expvolt = sprintf('%s%s%s%s',    char(g),exp,'_',data);
0034         PTSD.confile = sprintf('%s%s%s%s.txt',char(g),con,'_',data);
0035         PTSD.convolt = sprintf('%s%s%s%s',    char(g),con,'_',data);
0036         
0037         PTSD.diffile = sprintf('%s%s%s%s%s%s.txt',char(g),exp,'-',con,'_',data);
0038         PTSD.difvolt = sprintf('%s%s%s%s%s%s',    char(g),exp,'_',con,'_',data);
0039     end
0040     
0041     for c = {exp,con,dif},
0042         
0043         if findstr('-',char(c)),
0044             file = sprintf('%s%s%s%s%s%s.txt',char(g),exp,'-',con,'_',data);
0045             volt = sprintf('%s%s%s%s%s%s',    char(g),exp,'_',con,'_',data);
0046         else
0047             file = sprintf('%s%s%s%s.txt',char(g),char(c),'_',data);
0048             volt = sprintf('%s%s%s%s',    char(g),char(c),'_',data);
0049         end
0050         
0051         if ~exist(volt,'var')
0052             fprintf('loading %s\n',file);
0053             load(file);
0054             % Interpolate the Zero value
0055             V = eval(volt);
0056             InterpZero = interp1( timeArray(timeNonZero), V, 0, 'cubic' );
0057             V = [V(1:timeZero-1,:); InterpZero; V(timeZero:end,:)];
0058             eval(strcat(volt,' = V;'));
0059         else
0060             fprintf('Already loaded %s\n',file);
0061         end
0062     end
0063 end
0064 
0065 clear timeZero timeNonZero g c file volt V InterpZero

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