Home > eeg > egis > spline > replace_trial.m

# replace_trial

## PURPOSE

new_trialdata = replace_trial(trialdata,good_chan,xelec,yelec,zelec)

## SYNOPSIS

function new_trialdata = replace_trial(trialdata,good_chan,xelec,yelec,zelec)

## DESCRIPTION

``` new_trialdata = replace_trial(trialdata,good_chan,xelec,yelec,zelec)

eplace bad channels in a trial of data

trialdata = data with channels as columns
good_chan = good channel list
xelec,yelec,zelec = x,y,z, electrode positions```

## CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:

## SOURCE CODE

```0001 function new_trialdata = replace_trial(trialdata,good_chan,xelec,yelec,zelec)
0002 % new_trialdata = replace_trial(trialdata,good_chan,xelec,yelec,zelec)
0003 %
0004 %eplace bad channels in a trial of data
0005 %
0006 %
0007 % trialdata = data with channels as columns
0008 %good_chan = good channel list
0009 %xelec,yelec,zelec = x,y,z, electrode positions
0010 if nargin ~= 5
0011     error('incorrect number of input arguments')
0012 end
0013 v = zeros(1,size(good_chan,2));
0014 x = zeros(1,size(good_chan,2));
0015 y = zeros(1,size(good_chan,2));
0016 z = zeros(1,size(good_chan,2));
0017 x = xelec(good_chan);
0018 y = yelec(good_chan);
0019 z = zelec(good_chan);
0020 welec= 1;
0021 [k,kinv,a,ainv,e]= k_and_e(welec,x,y,z);
0022 for samp = 1:size(trialdata,1)
0023     w = trialdata(samp,:);
0024     v = w(good_chan);
0025     [p,q,error_check]= mateqs(welec,x,y,z,v,k,kinv,a,ainv,e);
0026     v_lap = interp_3d(welec,x,y,z,xelec,yelec,zelec,p,q);
0027     new_trialdata(samp,:) = v_lap;
0028 end; %for samp = 1:chdr(c,NPoints)
0029```

Generated on Sun 25-Aug-2019 04:00:39 by m2html © 2003