EEGLAB: cannot export channel locations from a text file
Show older comments
I have an EEG dataset in the form of a .mat file. This file is a structure containing, besides the actual electroencephalographic recording data, stacked according to different experimental conditions, a variable which stores the channel locations and coordinates (radius, X, Y ecc.). Since I would like to work with this dataset within the EEGLAB environment, I need to import, besides the electroencephalographic recording, also the channel locations/coordinates variable. Unfortunately, I am not able to convert it into a suitable format for the pop_chanedit GUI function. If I try to upload a .txt file containing these coordinates (by clicking on the "read locs" button), I get the following error:
Undefined function or variable "eloc".
Error in readlocs (line 469)
if isfield(eloc, 'sph_theta_besa')
Error in pop_chanedit (line 699)
[chans] = readlocs(tmpargs{:});
Error using waitfor
Error while evaluating UIControl Callback
If I try to modify the extension of the .txt file into a .loc file, which is supposed to be supported by the pop_chanedit function, I get another error:
Error using readlocs (line 541)
Channel numbers must be numeric
Error in pop_chanedit (line 873)
tmplocs = readlocs( chaninfo.filename, 'defaultelp', 'BESA' );
Error using waitfor
Error while evaluating UIControl Callback
So, is there any way to export the variable embedded into my structure containing the channel locations into EEGLAB? It looks like it only supports the sample data files, but whenever I try to use my personal channel locations it results in an error.
3 Comments
Walter Roberson
on 28 Jul 2019
The variable eloc can end up undefined in the code if the file extension is not one of the recognized ones (and possibly in some cases where it does recognize the extension; I would need to trace down all of the possibilities to be sure.) .txt is not one of the supported file extensions.
.loc files are expected to have 'channum' 'theta' 'radius' 'labels' -- no X Y or eccentricity.
I do not see any supported file formats that have eccentricity. chanedit files have 'channum' 'labels' 'theta' 'radius' 'X' 'Y' 'Z' 'sph_theta' 'sph_phi' 'sph_radius' 'type' which has radius and X and Y, but I do not see any eccentricity.
There are potentially .custom files that can include up to 4 custom fields that you could put the eccentricity into.
mimmo voso
on 29 Jul 2019
Kehinde Lawal
on 23 Jul 2020
@mimmso I am having a similar issue, so please how did you modify your .txt file to .loc file?
I would appreciate your feedback.
Kenny
Answers (2)
Sidney
on 27 Nov 2023
0 votes
I am having the same problem!
Sidney
on 28 Nov 2023
0 votes
Not sure if this helps anyone, but I actually was able to press "export to .ced" on the EEGLAB GUI (not the BEAPP GUI) regarding channel locations. (Like when you make a new study and then go to Edit and there's channel locations or channel information option (something to that effect). So it was able to save as a .ced on my computer and then select it during the "add new net" phase of BEAPP. I still haven't fully debugged BEAPP yet such that I can run the .ced through and get results. But, at least that was progress per this question!
Categories
Find more on EEG/MEG/ECoG in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!