vb_test_extract_trial_button ----- Trial onset extraction ----- --- Input parm.data_file : Data file name [string] parm.trig_file : Trial onset file name [string] parm.trig_type : trigger signal type [string] = 'integer' or 'analog' or 'voice' parm.slope : type of signal change [string] = 'const_start' or 'const_end' if trig_type = 'integer' 'low_to_high' or 'high_to_low' if trig_type = 'analog' No meaning if trig_type = 'voice' parm.condition : string describing condition [string or cell array] parm.status_ch : status channel name [string or cell array] parm.status_level : status level [1 x Ncomdition] parm.Pretrigger_ms : Pretrigger period [msec] parm.Posttrigger_ms: Posttrigger period [msec] --- Save variables status : status signal status_val(m) = status value for m-th condition (m=1:Ncomdition) trig(n) : Onset time index for n-th trial cond_id(n) : Condition ID for n-th trial if there are multi condition ix_trial(:,n) : Time index for n-th trial [Tperiod x Ntrial] Tperiod : # of time sample in one trial Ntrial : # of trials parm : parameter setting parm.fsamp : Sample Frequency [Hz] 2009-6-14 Masa-aki Sato Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 % vb_test_extract_trial_button 0002 % ----- Trial onset extraction ----- 0003 % --- Input 0004 % parm.data_file : Data file name [string] 0005 % parm.trig_file : Trial onset file name [string] 0006 % parm.trig_type : trigger signal type [string] 0007 % = 'integer' or 'analog' or 'voice' 0008 % parm.slope : type of signal change [string] 0009 % = 'const_start' or 'const_end' if trig_type = 'integer' 0010 % 'low_to_high' or 'high_to_low' if trig_type = 'analog' 0011 % No meaning if trig_type = 'voice' 0012 % parm.condition : string describing condition [string or cell array] 0013 % parm.status_ch : status channel name [string or cell array] 0014 % parm.status_level : status level [1 x Ncomdition] 0015 % parm.Pretrigger_ms : Pretrigger period [msec] 0016 % parm.Posttrigger_ms: Posttrigger period [msec] 0017 % --- Save variables 0018 % status : status signal 0019 % status_val(m) = status value for m-th condition (m=1:Ncomdition) 0020 % trig(n) : Onset time index for n-th trial 0021 % cond_id(n) : Condition ID for n-th trial if there are multi condition 0022 % ix_trial(:,n) : Time index for n-th trial [Tperiod x Ntrial] 0023 % Tperiod : # of time sample in one trial 0024 % Ntrial : # of trials 0025 % parm : parameter setting 0026 % parm.fsamp : Sample Frequency [Hz] 0027 % 0028 % 2009-6-14 Masa-aki Sato 0029 % 0030 % Copyright (C) 2011, ATR All Rights Reserved. 0031 % License : New BSD License(see VBMEG_LICENSE.txt) 0032 0033 clear all 0034 0035 % --- root directry 0036 root_dir = [getenv('MATHOME') '/Sekiyama']; 0037 % --- List of data file names (base name without extension) 0038 data_file = {'AM090311a'}; 0039 % data file extension 0040 ext = '.meg.mat'; 0041 % onset file sufix 0042 onset_name = 'button'; 0043 0044 plot_parm.mode = 1; % = 1: plot all trial 0045 % = 2: subplot for each trial 0046 % = 3: multiple trials in one subplot 0047 plot_parm.NXmax = 4; % # of trial in X-axis 0048 plot_parm.NYmax = 4; % # of subplot in Y-axis 0049 0050 % --- Set condition list 0051 % 432; ボタン押し 4 (Ba) 0052 % 434; ボタン押し 2 (Ga) 0053 % 435; 刺激提示 mik_B (movieの開始で立ち上がる) 0054 % 436; 刺激提示 mik_G 0055 % 437; 刺激提示 ter_B 0056 % 438; 刺激提示 ter_G 0057 % 442; 音声 0058 0059 parm.condition = {'Ba', 'Ga' }; 0060 parm.status_ch = {'432','434' }; 0061 parm.status_level = [ 0.5 , 0.5 ] ; 0062 parm.trig_type = 'analog'; 0063 parm.slope = 'low_to_high'; 0064 parm.Pretrigger_ms = [ 100 ]; % [msec] 0065 parm.Posttrigger_ms = [ 100 ]; % [msec] 0066 % trig(n) : Onset time index for n-th onset 0067 % cond_id(n) : Condition ID (1 or 2) for n-th onset 0068 0069 Nfile = length(data_file); 0070 0071 % --- Button press extraction 0072 for n=1:Nfile 0073 % MEG mat file 0074 parm.data_file = [data_file{n} ext]; 0075 0076 % Trial onset file 0077 parm.trig_file = [data_file{n} '_' onset_name '.trig.mat']; 0078 0079 % Get time index for each trial by checking status channel 0080 vb_job_trial_onset(root_dir,parm); 0081 0082 if plot_parm.mode > 0, 0083 % png file name 0084 fpng = [root_dir '/' data_file{n} '_' onset_name ]; 0085 %plot_parm.png = fpng; 0086 0087 vb_plot_status([root_dir '/' parm.trig_file ], plot_parm); 0088 end 0089 end 0090 0091 load([root_dir '/' data_file{n} '_' onset_name '.trig.mat'],'trig','cond_id') 0092 0093 return