[Eeglablist] interpolating channels by scripts
José Luis
joseluisulloafulgeri at gmail.com
Mon May 15 08:41:11 PDT 2017
hello Nike, Andres and Joshua,
Thanks for all responses,
I did what Nike suggested to me and it works. Then I have to solve the
problem that the channel were not in the good order, which I did with:
EEG = pop_interp(EEG, orichannels(recoverChan), 'spherical');
EEG.chanlocs = orichannels;
data = EEG.data([1:recoverChan-1 66 recoverChan:65],:); %data =
EEG.data([1:56 66 57:65],:);
EEG.data = data;
Next I see Andreas answer, so, yes, I will try the option 3 which should
give the same I did above right?
Regarding the empty ALLEG variable, for instance "ALLEEG(1)" will give me
an error. When I run the script I open EEGlab from the script, like:
cd (fullfile(Dir, 'ERP_step4b1'))
filelist = dir('*.set');
filelist = {filelist.name};
for i_file = 1:length(filelist)
[ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab; % open EEGLAB
%% load dataset
stepPath = fullfile(Dir, 'ERP_step4b1');
eval(['EEG = pop_loadset(''filename'',''' filelist{1, i_file}
''',''filepath'', ''' stepPath ''');']);
EEG = eeg_checkset(EEG);
%% load ori channels
load
C:\Users\ulloafjl\Documents\Academia\Research_Projects\IMCO_EEG\IMCO_EEG_RealExp\2_processed_data\orichannels.mat
%% interpolate if necessary
if i_file == 3
recoverChan = 57; % 1 CHANNEL
EEG = pop_interp(EEG, orichannels(recoverChan), 'spherical');
EEG.chanlocs = orichannels;
data = EEG.data([1:recoverChan-1 66 recoverChan:65],:); %data =
EEG.data([1:56 66 57:65],:);
EEG.data = data;
etc ...
When the EEGlab GUI is open and I stop to debug in "if = i_file==3", the
EEG variable has the data, but the ALLLEG variable is empty, because the
data is not open in the GUI, so if I call ALLEEG(1) then I get the error,
I don't care about using the GUI that why I'm doing the script, but the
issue comes when I want to use that variable to do some things,
Is the problem more clear? It's not a big deal now, but sometimes I have to
find a workaround because of the fact this variable is empty,
** update ** Ok, Now I try "eeglab redraw" and the variable change. So I
need to use this in the scripts to update the ALLEEG variable I guess?
best,
Jose
On 12 May 2017 at 16:51, José Luis <joseluisulloafulgeri at gmail.com> wrote:
> hello,
>
> I'm currently doing the preprocessing of an EEG dataset,
> Before ICA I removed some bad channels, and after rejecting the bad
> components I'm trying to get back these channels interpolating with
> pop_interp,
>
> However, I'm having problems for doing this. First, I have to load another
> dataset to indicate which channel I want to interpolate because when I open
> the dataset to interpolate the list of channels has updated and if I want
> to interpolate the channel 57, it removes and interpolates the current 57
> (which was before 58),
>
> So I need to open another dataset, and indicate that I want to interpolate
> the channel 57 from that original dataset with the full 66 channels,
>
> Second, while trying to do this, opening two datasets, I was confronted
> with the problem that when running a script the dataset is covertly open
> and the MATLAB workspace doesn't perceive it and if I ask for:
>
> EEG = pop_interp(EEG, ALLEEG(1).chanlocs(recoverChan), 'spherical');
> where recoverChan = 57 (commands lines I get when testing it manually),
>
> the system rightly warning me "Index exceeds matrix dimensions" because
> indeed the variable ALLEEG is empty,
>
> Somebody knows a trick to solve this?
>
> best
> Jose
>
--
José Luis ULLOA FULGERI, PhD
https://sites.google.com/site/joseluisulloafulgeri/
+447780319714
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20170515/d2f9933c/attachment.html>
More information about the eeglablist
mailing list