-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pop_chanedit fails to append reference channel #821
Comments
Thanks for reporting. EEG.chanlocs(x).label is not supposed to be a field in EEG.chanlocs. I am not sure why this section of the code of eeg_checkset is executed on your side. It is meant for future versions of EEGLAB where EEG.chanlocs.labels will be renamed EEG.chanlocs.label (without s), because the s should have never been there in the first place. However, for the current version, it should have no incidence. |
Thank you for your answer... what do you suggest me? remove eeg_checkset in pop_chanedit? Or is this not possible? Sorry, I am new to eeglab and I do not know how to proceed properly. Alternatively, I can set the reference channel by "hand" instead of using pop_chanedit, if you think this will not cause a problem... Sorry for insisting, I am a bit clueless |
Hello. I have the same issue. Whenever I try to add a channel (using the Append or Insert button in Edit/Channel Locations, or using pop_chanedit in a script) I always end up with all the labels changing to 'E'. EEGLAB 2024.2 |
Yes, EEGLAB will rename your channels to E1, E2, etc. if your labels are 1, 2, 3, etc. Is that what you mean? |
No. Sorry. I meant that labels such as 'Fp1', 'Fpz', Fp2' etc. were all changed to 'E', 'E', 'E' etc. after using pop_chanedit (via script or gui). I think I've fixed it in my local version by changing Line 686 in pop_chanedit from: Was that the right thing to do? |
The reference channels is set using the 'ref' field, not the 'labels' field |
Any time pop_chanedit was called for any reason, it would fill EEG.chanlocs.labels with 'E' on every row. This didn't happen in previous versions of EEGLAB. I tried changing chans.label to chans.labels in pop_chanedit following your comment to carvidarb above. That seemed to fix it. I think it might just be a typo on Line 686 of pop_chanedit because the chans.label column doesn't exist before that line and isn't used anywhere else in the function. |
Sounds good. Happy it is fixed. Yes, the correct spelling is "labels" not "label" (I know it is not logical). |
Thanks. I've just sent a pull request. #825 |
Description
I downloaded a matlab toolbox to analyse eeg data, additionally to eeglab. This toolbox is used to analyse eeg data from people who experience pain. This toolbox is based on EEG lab and I am using it with their demo data. In this code pop_chanedit fails to add the reference channel, in the EEGtemp structure that is returned, chanlocs.labels are all 'E', but in the original EEGtemp, the labels in chanlocs are correct. I could track the problem until eeg_checkset in line 1081. At that point, the field labels is correct and a field called label has appeared and is empty. Then inside eeg_checkset, line 272, the field labels is interchanged with the field label, which is empty and messes up the labels field.
The channel to insert is A1 (the reference). In the main script of the analysis toolbox it is written:
Steps to Reproduce
'changefield', {EEGtemp.nbchan+1,'labels',ALLEEG(iRec).BIDS.tInfo.EEGReference},...
'changefield', {EEGtemp.nbchan+1, 'X', params.RefCoord.X}, ...
'changefield', {EEGtemp.nbchan+1, 'Y', params.RefCoord.Y}, ...
'changefield', {EEGtemp.nbchan+1, 'Z', params.RefCoord.Z},...
'setref',{['1:' num2str(EEGtemp.nbchan)],ALLEEG(iRec).BIDS.tInfo.EEGReference});
without knowing very well what I am doing (I am new to eeglab), I added in the main script:
for ichan=1:length(EEGtemp.chanlocs)
EEGtemp.chanlocs(ichan).label=EEGtemp.chanlocs(ichan).labels;
end
between steps 1 and 2. In this case, the updated EEGtemp after pop_chanedit, has the correct chanlocs.labels, but the reference channel is not added to the rest.
Expected behavior:
I expect that the reference channels is added without changing any field of the other channels, apart from setref (I suppose)
Actual behavior:
The labels in chanlocs are messed up, all are the same and it is 'E'. If I write the additional code, the labels are fine (because eeg_checkset cannot mess them up, but the reference channel is not added.
Versions
The text was updated successfully, but these errors were encountered: