<div dir="ltr"><div>hello Nike, Andres and Joshua,<br><br>Thanks for all responses,<br>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:<br><br>        EEG = pop_interp(EEG, orichannels(recoverChan), 'spherical');<br>        EEG.chanlocs = orichannels;<br>        data = EEG.data([1:recoverChan-1 66 recoverChan:65],:); %data = EEG.data([1:56 66 57:65],:);<br>        EEG.data = data;<br><br>Next I see Andreas answer, so, yes, I will try the option 3 which should give the same I did above right?<br><br>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:<br><br>cd (fullfile(Dir, 'ERP_step4b1'))<br>filelist = dir('*.set');<br>filelist = {<a href="http://filelist.name">filelist.name</a>};<br><br>for i_file = 1:length(filelist)<br>    <br>    [ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab; % open EEGLAB<br><br>    %% load dataset<br>    stepPath = fullfile(Dir, 'ERP_step4b1');<br>    eval(['EEG = pop_loadset(''filename'',''' filelist{1, i_file} ''',''filepath'', ''' stepPath ''');']);<br>    EEG = eeg_checkset(EEG);<br><br>    %% load ori channels<br>    load C:\Users\ulloafjl\Documents\Academia\Research_Projects\IMCO_EEG\IMCO_EEG_RealExp\2_processed_data\orichannels.mat<br>    <br>    %% interpolate if necessary<br>    if i_file == 3<br>        recoverChan = 57; % 1 CHANNEL<br>        EEG = pop_interp(EEG, orichannels(recoverChan), 'spherical');<br>        EEG.chanlocs = orichannels;<br>        data = EEG.data([1:recoverChan-1 66 recoverChan:65],:); %data = EEG.data([1:56 66 57:65],:);<br>        EEG.data = data;<br>        <br>etc ...<br><br>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,<br>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,<br>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,<br><br></div>** 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?<br><div><br>best,<br>Jose<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 12 May 2017 at 16:51, José Luis <span dir="ltr"><<a href="mailto:joseluisulloafulgeri@gmail.com" target="_blank">joseluisulloafulgeri@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">hello,<br><br>I'm currently doing the preprocessing of an EEG dataset,<br>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,<br><br>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),<br><br>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,<br><br>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:<br><br>EEG = pop_interp(EEG, ALLEEG(1).chanlocs(<wbr>recoverChan), 'spherical'); where recoverChan = 57 (commands lines I get when testing it manually),<br><br>the system rightly warning me "Index exceeds matrix dimensions" because indeed the variable ALLEEG is empty,<br><br>Somebody knows a trick to solve this?<br><br>best<br>Jose<br></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">José Luis ULLOA FULGERI, PhD<br><a href="https://sites.google.com/site/joseluisulloafulgeri/" target="_blank">https://sites.google.com/site/joseluisulloafulgeri/</a><br><span style="border-collapse:separate;color:rgb(102,102,102);font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><span style="font-family:arial;font-size:small"><span style="font-family:tahoma,sans-serif"><span style="border-collapse:separate;color:rgb(102,102,102);font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><span style="font-family:arial;font-size:small"></span></span></span></span></span></div></div><div dir="ltr"><span style="font-size:12.8px">+44</span>7780319714<br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div>