<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-NZ" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Hi Moumita,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">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. <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">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. <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Last, the line
</span> “ cfg.outputfile = sprintf('raw%s_%d.mat', subj{s},trig(c)); “ doesn’t do anything.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Xavier<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;color:#595555">Dr Xavier Vrijdag, MSc PhD</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:5.0pt;color:black"> </span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-line-height-alt:8.0pt"><b><span style="font-size:10.0pt;color:#006060">Research fellow</span></b><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;color:#595555">Department of Anaesthesiology </span><span style="font-size:10.0pt;color:#006060">│</span><span style="font-size:10.0pt;color:black"> </span><span style="font-size:10.0pt;color:#595555">School
of Medicine</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;color:#595555">Faculty of Medical & Health Sciences </span><span style="font-size:10.0pt;color:#006060">│</span><span style="font-size:10.0pt;color:black"> </span><span style="font-size:10.0pt;color:#595555">The
University of Auckland</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;color:#595555">Private Bag 92019 </span><span style="font-size:10.0pt;color:#006060">│</span><span style="font-size:10.0pt;color:black"> </span><span style="font-size:10.0pt;color:#595555">Auckland 1142 </span><span style="font-size:10.0pt;color:#006060">│</span><span style="font-size:10.0pt;color:black"> </span><span style="font-size:10.0pt;color:#595555">New
Zealand</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;color:black"> </span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;color:#006060">M</span></b><span style="font-size:10.0pt;color:black"> </span><span style="font-size:10.0pt;color:#595555">+64 21 0230 4558</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;color:#006060">E </span></b><span style="font-size:10.0pt;color:#006060"><a href="mailto:x.vrijdag@auckland.ac.nz"><span style="color:#044A91">x.vrijdag@auckland.ac.nz</span></a><b> </b></span><b><span style="font-size:8.0pt;font-family:"Verdana",sans-serif;color:black"> </span></b><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:8.0pt;font-family:"Verdana",sans-serif;color:black"><img border="0" width="315" height="48" style="width:3.2812in;height:.5in" id="Picture_x0020_1" src="cid:image001.png@01D893A2.623C8CB0" alt="FMHS Logo "></span></b><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">fieldtrip <fieldtrip-bounces@science.ru.nl> on behalf of Moumita bhowmick via fieldtrip <fieldtrip@science.ru.nl><br>
<b>Reply to: </b>FieldTrip discussion list <fieldtrip@science.ru.nl><br>
<b>Date: </b>Saturday, 9 July 2022 at 7:24 AM<br>
<b>To: </b>FieldTrip discussion list <fieldtrip@science.ru.nl><br>
<b>Cc: </b>Moumita bhowmick <bhowmickmoumita1@gmail.com><br>
<b>Subject: </b>[FieldTrip] Difficulty in preprocessing multiple dataset<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Hello,<o:p></o:p></p>
<div>
<p class="MsoNormal">To preprocess multiple data, I entered the following command:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">subj = {'S1_MD_5_epochs.set','S1_MD_6_epochs.set','S1_MD_7_epochs.set','S1_MD_8_epochs.set'};<br>
trig = ['BC' 'BnC' 'PC' 'PnC' 'SC' 'SnC'];<br>
<br>
for s = 1:4<br>
for c = 1:6<br>
<br>
cfg = [];<br>
cfg.dataset = subj{s};<br>
cfg.trigger = trig(c);<br>
raw_data1 = ft_preprocessing(cfg);<br>
cfg.outputfile = sprintf('raw%s_%d.mat', subj{s},trig(c));<br>
filename = sprintf('raw%s_%d.mat', subj{s},trig(c));<br>
save (filename, 'raw_data1')<br>
<br>
end<br>
end<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">When I checked the size of the data matrix of raw_data1, it was 1x1. My questions are:<br>
<br>
1. Shouldn't it be 4x6 as there are 4 subjects and 6 conditions? <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">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? <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">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). <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Am I wrong in thinking this way? How to solve the problem?<o:p></o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal">Moumita Bhowmick<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">PhD student <o:p></o:p></p>
<div>
<p class="MsoNormal">School of Cognitive Science,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Jadavpur University<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>