[Eeglablist] Loading both .set and .fdt files in command line
Velu Prabhakar Kumaravel
velu.kumaravel at unitn.it
Thu Mar 17 11:14:17 PDT 2022
Hi Patrick,
If you have EEGLAB 2021.0 installed, the following code should work (I
fixed a couple of errors). I think the .fdt files should be in the same
folder as .set files. Besides that, no special treatment is required.
filePath = '\eeglab2021.0\sample_data'; % your EEGLAB sample_data folder
path
filePattern = fullfile(filePath, '*.set' );
theFiles = dir(filePattern);
for k = 1 : length(theFiles)
fprintf('File ID: %d\n', k)
baseFileName = theFiles(k).name;
fullFileName = fullfile(theFiles(k).folder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
%EEG = pop_loadset(fullFileName); %STEP 1
EEG = pop_loadset('filename',baseFileName,'filepath',filePath);
disp(size(EEG.data))
end
Let me know if it works!
Best regards,
Velu Prabhakar Kumaravel, Ph.D. Student
Center for Mind/Brain Sciences,
University of Trento, Italy
On Thu, 17 Mar 2022 at 18:53, Patrick Bloniasz <pblonias at bowdoin.edu> wrote:
> Hi all,
>
> I am trying to pull some information from many files in a for loop in
> MATLAB without using the EEGLAB GUI. When I load a file in the GUI by
> clicking "load existing data set" and picking a .set file, both the .fdt
> and .set file load properly. However, if I use something like:
>
> filePattern = fullfile(curexperiment.dirroot, '*.set' );
> theFiles = dir(curexperiment.dirroot);
> for k = 1 : length(theFiles)
> baseFileName = theFiles(k).name;
> fullFileName = fullfile(theFiles(k).folder, baseFileName);
> fprintf(1, 'Now reading %s\n', fullFileName);
> EEG = pop_loadset(fullFileName); %STEP 1
> EEG =
> pop_loadset('filename',baseFileNames,'filepath',curexperiment.dirroot);
> [....]
> end
>
> It does not work, because I can only get the .set file to load. The object
> structure I need is in the .fdt file. However, if I change that first line
> to something like:
>
> filePattern = fullfile(curexperiment.dirroot, '*.(set|fdt)' ); (i.e.,
> either a set or an fdt)
>
> It doesn't load either file (but does not turn an error).
>
> I took the step to do the "save script file" after loading it from the GUI
> to see if I am doing something wrong, but it similarly just uses the simple
> .set input and somehow also grabs the .fdt in a way I can't see that isn't
> working in my for loop.
>
> Does someone have any thoughts on how to load both the .set and .fdt file
> simultaneously without having to use the GUI for all files in a given
> directory?
>
> Patrick
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
>
More information about the eeglablist
mailing list