Home > vbmeg > demo > tutorial_for_vbmeg2 > advanced > separate_eeg.m

separate_eeg

PURPOSE ^

Separate trials into auditory, somatosensory, and visual tasks

SYNOPSIS ^

function separate_eeg(p)

DESCRIPTION ^

 Separate trials into auditory, somatosensory, and visual tasks

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function separate_eeg(p)
0002 % Separate trials into auditory, somatosensory, and visual tasks
0003 %
0004 % Copyright (C) 2011, ATR All Rights Reserved.
0005 % License : New BSD License(see VBMEG_LICENSE.txt)
0006 
0007 disp(mfilename);
0008 
0009 % Load fileinfo of all the trials
0010 data_file = fullfile(p.proj_root, p.eeg_dirname, p.trial_dirname, 'crri_all.info.mat');
0011 load(data_file, 'fileinfo', 'Measurement')
0012 
0013 % Extract active trials
0014 trial_ix = find(fileinfo.ActiveTrial == 1);
0015 cond = fileinfo.cond_id(trial_ix);
0016 
0017 % Separate trials into tasks
0018 for ta = unique(p.cond_list)
0019     fileinfo.ActiveTrial = zeros(1, fileinfo.Ntotal);
0020     fileinfo.ActiveTrial(trial_ix(cond == ta)) = 1;
0021     save_file = fullfile(p.proj_root, p.eeg_dirname, p.trial_dirname, ...
0022                     ['crri_' p.task_list{ta} '.info.mat']);
0023     save(save_file, 'fileinfo', 'Measurement')
0024     disp(['Ntrials for task ' p.task_list{ta} ': ' num2str(length(find(fileinfo.ActiveTrial == 1)))])
0025 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005