[Eeglablist] Loading both .set and .fdt files in command line

Patrick Bloniasz pblonias at bowdoin.edu
Wed Mar 16 23:11:46 PDT 2022


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



More information about the eeglablist mailing list