Clear Filters
Clear Filters

how to load multiple eeg dataset files into matlab?

9 views (last 30 days)
i have 88 eeg data files, their extension is '.set'
they are all in the same folder titled 'all_data', i am really new at MATLAB, i am unable to figure out how to load all of them at once in my workspace.
i used the line below to load one file, but doing the same for 88 files is a lot of hassle
eegdata= pop_loadset('C:\Users\Parul\Documents\MATLAB\secondary_data\all data\sub-01_task-40HzAuditoryEntrainment_eeg.set')
Please help

Answers (1)

Cris LaPierre
Cris LaPierre on 25 Apr 2024
Edited: Cris LaPierre on 25 Apr 2024
I would use a fileDatastore to load all the data into a single variable. You can see an example of how to use one to do this in this video from the Data Processing with MATLAB specialization on Coursera.
Here is the final code from that example. You can modify this to work for your data.
flightsDataStore = fileDatastore("flights*.csv","ReadFcn",@importFlightsData,"UniformRead",true);
flightsAll = readall(flightsDataStore)
Once complete, all the data from all files matching the pattern "flights*.csv" are loaded into the variable flightsAll.


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!