User Tools

Site Tools


Sidebar

Home

EEGLAB Hackathon
Scripts
Main Website
Contact

bastien.b1@gmail.com

eeglabsessh1b

This is an old revision of the document!


Be patient :) This page will go live on Wed, 5th at 10am.

Until then, check the overview page where you will find all the info about the hackathon.
You can also download the necessary files here.

NightCrew.m
subject={'504', '505'};
 
pathname_read='/Users/Shared/HackathonFiles/TutorialData/EEGHack1/';
patname_write='/Users/Shared/HackathonFiles/TutorialData/EEGHack1/NightCrew';
 
for i=1:length(subject)
   fprintf('Processing Subject #g : %s…\n', i, subject{i});
 
%creates the destination folder assuming you have not created it manually before
%if test makes sure the folder only gets created once.
    if i==1
    [mdirstatus, mdirmessage]=mkdir(pathname_write)
    end
 
    try
    %add electrode positions, and specify online ref
	EEG = pop_loadcnt([pathname_read subject{i} '.cnt'] , 'dataformat', 'int32', 'memmapfile', '');
	EEG = pop_chanedit(EEG, 'append',66,'changefield',{67 'labels' 'Cz'},'lookup','/Users/pss059/Documents/MATLAB/eeglab12_0_2_5b/plugins/dipfit2.2/standard_BESA/standard-10-5-cap385.elp','setref',{'1:67' 'Cz'});
 
    %re-reference to common average & reconstruct signal at current reference
    EEG = pop_reref( EEG, [],'refloc',struct('labels',{'Cz'},'type',{''},'theta',{0},'radius',{0},'X',{5.2047e-15},'Y',{0},'Z',{85},'sph_theta',{0},'sph_phi',{90},'sph_radius',{85},'urchan',{67},'ref',{'Cz'},'datachan',{0}), 'exclude',[65 66]);
 
 
    %make epochs (all triggers of interest individually
    %we will in fact comment the remove baseline step since at the minute
    %we just want to cut the file to reduce dimensions.
    EEG = pop_epoch( EEG, {  '111'  '112'  '113'  '114'  '121'  '122'  '123'  '124'  '131'  '132'  '133'  '134'  '141'  '142'  '143'  '144'  '151'  '152'  '153'  '154'  '211'  '212'  '213'  '214'  '221'  '222'  '223'  '224'  '231'  '232'  '233'  '234'  '241'  '242'  '243'  '244'  '251'  '252'  '253'  '254'  }, [-0.1 1], 'epochinfo', 'yes');
    %EEG = pop_rmbase( EEG, [-100    0]);
 
    %We could already delete epochs which are followed by an incorrect
    %response. Although I prefer to keep this for the subsequent Day Crews
    %EEG = pop_selectevent( EEG, 'type',1,'deleteevents','off','deleteepochs','on','invertepochs','off');
 
    %Save set prior to filtering (in case of crash)
    EEG.setname = [subject{i} 'RREP'];
    EEG = pop_saveset( EEG,  'filename', [pathname_write subject{i} '_RREP.set']);
 
    %filter the data
    EEG  = pop_basicfilter( EEG,  1:67 , 'Cutoff', [ 0.1 30], 'Design', 'butter', 'Filter', 'bandpass', 'Order',  4 );
 
    %Save intermediary set in case ICA crashes
    EEG.setname = [subject{i} 'RREPF'];
    EEG = pop_saveset( EEG,  'filename', [pathname_write subject{i} '_RREPF.set']);
 
    %run ICA decomposition
    EEG = pop_runica(EEG, 'extended',1,'interupt','on');
 
    %Save final set
    EEG.setname = [subject{i} 'RREPFICA'];
    EEG = pop_saveset( EEG,  'filename', [pathname_write subject{i} '_RREPFICA.set']);
    catch
        disp(['Something went wrong with participant' subject{i} '! Skipping to next participant']);
    end
end
eeglabsessh1b.1391012880.txt.gz · Last modified: 2014/10/08 03:14 (external edit)