[FieldTrip] Difficulty in preprocessing multiple dataset

Xavier Vrijdag x.vrijdag at auckland.ac.nz
Sat Jul 9 04:44:25 CEST 2022


Hi Moumita,

Your code does rewrite the raw_data1 variable with every iteration. So after running this code you will find the results of only the last run (s=4 c=6) in the variable. If you want all data loaded into memory, you can save them in a cell array by replacing the part before the = with raw_data1{s,c}. However, I am not sure if this would fit, as it highly depends on how big your data files are and if it is actually needed as this depends on the continued steps of your analysis pipeline.

Each iteration of the loop did initiate a save command, so you should have 24 files in your folder (same folder as your matlab code file). You can use these files (by loading each of them) to continue your analysis.

Last, the line    “ cfg.outputfile = sprintf('raw%s_%d.mat', subj{s},trig(c)); “ doesn’t do anything.

Regards,

Xavier


Dr Xavier Vrijdag, MSc PhD

Research fellow
Department of Anaesthesiology │ School of Medicine
Faculty of Medical & Health Sciences │ The University of Auckland
Private Bag 92019 │ Auckland 1142 │ New Zealand

M +64 21 0230 4558
E x.vrijdag at auckland.ac.nz<mailto:x.vrijdag at auckland.ac.nz>

[FMHS Logo]




From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of Moumita bhowmick via fieldtrip <fieldtrip at science.ru.nl>
Reply to: FieldTrip discussion list <fieldtrip at science.ru.nl>
Date: Saturday, 9 July 2022 at 7:24 AM
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Cc: Moumita bhowmick <bhowmickmoumita1 at gmail.com>
Subject: [FieldTrip] Difficulty in preprocessing multiple dataset

Hello,
To preprocess multiple data, I entered the following command:
subj = {'S1_MD_5_epochs.set','S1_MD_6_epochs.set','S1_MD_7_epochs.set','S1_MD_8_epochs.set'};
trig = ['BC' 'BnC' 'PC' 'PnC' 'SC' 'SnC'];

for s = 1:4
for c = 1:6

    cfg = [];
    cfg.dataset = subj{s};
    cfg.trigger = trig(c);
    raw_data1 = ft_preprocessing(cfg);
    cfg.outputfile = sprintf('raw%s_%d.mat', subj{s},trig(c));
    filename = sprintf('raw%s_%d.mat', subj{s},trig(c));
    save (filename, 'raw_data1')

end
end

When I checked the size of the data matrix of raw_data1, it was 1x1. My questions are:

1. Shouldn't it be 4x6 as there are 4 subjects and 6 conditions?
2. When I checked the raw_data1.hdr.orig I found only the last subject's data matrix. What happened to the remaining subjects' data matrix?
3. Is this matrix the average of all the datasets? (I don't have an equal number of epochs. When I checked the epoch length, raw_data1 is considering only the last participant's number of epochs).

Am I wrong in thinking this way? How to solve the problem?
--
Moumita Bhowmick
PhD student
School of Cognitive Science,
Jadavpur University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220709/e9200bc5/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 22260 bytes
Desc: image001.png
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220709/e9200bc5/attachment.png>


More information about the fieldtrip mailing list