Home > vbmeg > functions > common > utility > vb_trial_rejection.m

vb_trial_rejection

PURPOSE ^

function [MEGinfo,bexp,eeg] = vb_trial_rejection(MEGinfo,bexp,eeg,rejectTrial)

SYNOPSIS ^

function [MEGinfo,bexp,eeg] = vb_trial_rejection(MEGinfo,bexp,eeg,rejectTrial)

DESCRIPTION ^

function [MEGinfo,bexp,eeg] = vb_trial_rejection(MEGinfo,bexp,eeg,rejectTrial)


 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 [MEGinfo,bexp,eeg] = vb_trial_rejection(MEGinfo,bexp,eeg,rejectTrial)
0002 %function [MEGinfo,bexp,eeg] = vb_trial_rejection(MEGinfo,bexp,eeg,rejectTrial)
0003 %
0004 %
0005 % Copyright (C) 2011, ATR All Rights Reserved.
0006 % License : New BSD License(see VBMEG_LICENSE.txt)
0007 
0008 % Absolute channel inndex for bexp, pick & Qpick
0009 TrialNumber = MEGinfo.TrialNumber;
0010 Ntrial = length(TrialNumber);
0011 
0012 % Extract active channel index from 'MEGch_id' different from 'reject_channel'
0013 Trial_act = vb_setdiff2(TrialNumber, rejectTrial);
0014 
0015 MEGinfo.Nrepeat = length(Trial_act);
0016 MEGinfo.TrialNumber = Trial_act;
0017 
0018 Nmax   = max(TrialNumber);
0019 
0020 if max(rejectTrial) > Nmax,
0021     error('Reject trial index is larger than trial number');
0022 end
0023 
0024 if Ntrial ~= (MEGinfo.Nrepeat + length(rejectTrial))
0025     error('Reject trial index is not in trial index');
0026 end
0027 
0028 % Convert absolute index to relative index
0029 itrans = zeros(Nmax,1);
0030 itrans(TrialNumber) = 1:Ntrial;
0031 
0032 id_act = itrans(Trial_act);     % active trial index
0033 
0034 % Extract active channel
0035 bexp  = bexp(:,:,id_act);
0036 eeg  = eeg(:,:,id_act);
0037 
0038 return

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