Dear Fieldtrip users,<div><br></div><div>I've been trying to run group stats on my EEG source data, which contains 14 subjects' normalized beamformer data, and having serious swap memory issue (not Matlab memory issue, but OS swap memory).</div>

<div><br></div><div>I'm trying to contrast 2 conditions (within subject design). Each subject's normalized beamformer data (1 condition) is </div><div><br></div><p class="MsoNormal"><font color="#000099">source_lTMI_intNorm = </font></p>



<p class="MsoNormal"><font color="#000099">      anatomy: [181x217x181 double]</font></p>

<p class="MsoNormal"><font color="#000099">       inside: [181x217x181 logical]</font></p>

<p class="MsoNormal"><font color="#000099">          avg: [1x1
struct]</font></p>

<p class="MsoNormal"><font color="#000099">   
transform: [4x4 double]</font></p>

<p class="MsoNormal"><font color="#000099">          dim: [181
217 181]</font></p>

<p class="MsoNormal"><font color="#000099">          cfg: [1x1
struct]</font></p><p class="MsoNormal"><br></p><p class="MsoNormal">>whos</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal"><span style="background-color:rgb(255,255,255)"><font color="#000099">Name                    
Size               
Bytes  Class     Attributes</font></span><span style="color:rgb(0,0,153);background-color:rgb(255,255,255)"> </span><span style="background-color:rgb(255,255,255);color:rgb(0,0,153)">     </span></p>

<p class="MsoNormal"><span style="background-color:rgb(255,255,255)"><font color="#000099"> 
source_lTMI_intNorm      1x1            
520114791  struct</font></span></p><p class="MsoNormal"><br></p><p class="MsoNormal">therefore, when I open all subjects' data ("data1group" and "data2group"), it's huge...</p><p class="MsoNormal">

<span style="font-family:Arial;font-size:10pt;color:rgb(0,0,153)">Name</span><span style="font-family:Arial;font-size:10pt;color:rgb(0,0,153)">           
</span><span style="font-family:Arial;font-size:10pt;color:rgb(0,0,153)">Size</span><span style="font-family:Arial;font-size:10pt;color:rgb(0,0,153)">                
</span><span style="font-family:Arial;font-size:10pt;color:rgb(0,0,153)">Bytes</span><span style="font-family:Arial;font-size:10pt;color:rgb(0,0,153)">  </span><span style="font-family:Arial;font-size:10pt;color:rgb(0,0,153)">Class</span><span style="font-family:Arial;font-size:10pt;color:rgb(0,0,153)">     </span><span style="font-family:Arial;font-size:10pt;color:rgb(0,0,153)">Attributes</span><span style="color:rgb(0,0,153);font-family:Arial;font-size:10pt">     </span></p>

<p class="MsoNormal"></p><p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt"> </span><span style="font-family:Arial;font-size:10pt">data1group</span><span style="font-family:Arial;font-size:10pt">     
</span><span style="font-family:Arial;font-size:10pt">1x14</span><span style="font-family:Arial;font-size:10pt">           
</span><span style="font-family:Arial;font-size:10pt">5909429438</span><span style="font-family:Arial;font-size:10pt">  </span><span style="font-family:Arial;font-size:10pt">cell</span><span style="font-family:Arial;font-size:10pt">     </span><span style="font-family:Arial;font-size:10pt">           </span></font></p>

<p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt"> </span><span style="font-family:Arial;font-size:10pt">data2group</span><span style="font-family:Arial;font-size:10pt">     
</span><span style="font-family:Arial;font-size:10pt">1x14</span><span style="font-family:Arial;font-size:10pt">           
</span><span style="font-family:Arial;font-size:10pt">6705652782</span><span style="font-family:Arial;font-size:10pt">  </span><span style="font-family:Arial;font-size:10pt">cell</span><span style="font-family:Arial;font-size:10pt">               </span></font></p>

<p class="MsoNormal"><br></p><p class="MsoNormal"></p><p class="MsoNormal">data1group & data2group are both 1x14 struct (1 cell/subject). Therefore,</p><p class="MsoNormal"></p><p class="MsoNormal">>data1group{1}</p>

<p class="MsoNormal"><font color="#000099">anatomy: [181x217x181 double]</font></p><p class="MsoNormal"><font color="#000099">       inside: [181x217x181 logical]</font></p><p class="MsoNormal"><font color="#000099">          avg: [1x1 struct]</font></p>

<p class="MsoNormal"><font color="#000099">    transform: [4x4 double]</font></p><p class="MsoNormal"><font color="#000099">          dim: [181 217 181]</font></p><p class="MsoNormal"><font color="#000099">          cfg: [1x1 struct]</font></p>

<p></p><p></p><p></p><p class="MsoNormal">So, when I try to run </p><p class="MsoNormal"><font color="#000099"><span style="font-size:10.0pt;font-family:Arial">cfg=[];</span>

</font></p><p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">cfg.dim</span><span style="font-family:Arial;font-size:10pt">         </span><span style="font-family:Arial;font-size:10pt">=
data1group{1}.dim;</span></font></p><p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">cfg.method</span><span style="font-family:Arial;font-size:10pt">      </span><span style="font-family:Arial;font-size:10pt">= </span><span style="font-family:Arial;font-size:10pt">'montecarlo'</span><span style="font-family:Arial;font-size:10pt">;</span></font></p>

<p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">cfg.statistic</span><span style="font-family:Arial;font-size:10pt">   </span><span style="font-family:Arial;font-size:10pt">= </span><span style="font-family:Arial;font-size:10pt">'depsamplesT'</span><span style="font-family:Arial;font-size:10pt">;</span></font></p>

<p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">cfg.parameter</span><span style="font-family:Arial;font-size:10pt">   </span><span style="font-family:Arial;font-size:10pt">= </span><span style="font-family:Arial;font-size:10pt">'avg.pow'</span><span style="font-family:Arial;font-size:10pt">;</span></font></p>

<p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">cfg.correctm</span><span style="font-family:Arial;font-size:10pt">    </span><span style="font-family:Arial;font-size:10pt">= </span><span style="font-family:Arial;font-size:10pt">'cluster'</span><span style="font-family:Arial;font-size:10pt">;</span></font></p>

<p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">cfg.numrandomization = 100;</span></font></p><p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">cfg.alpha</span><span style="font-family:Arial;font-size:10pt">       </span><span style="font-family:Arial;font-size:10pt">= 0.05;</span></font></p>

<p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">cfg.tail</span><span style="font-family:Arial;font-size:10pt">        </span><span style="font-family:Arial;font-size:10pt">= 0;</span></font></p>

<p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">nsubj=length(data1group);</span></font></p><p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">cfg.design(1,:) = [1:nsubj 1:nsubj];</span></font></p>

<p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">cfg.design(2,:) = [ones(1,nsubj) ones(1,nsubj)*2];</span></font></p><p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">cfg.uvar</span><span style="font-family:Arial;font-size:10pt">        </span><span style="font-family:Arial;font-size:10pt">= 1; </span></font></p>

<p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">cfg.ivar</span><span style="font-family:Arial;font-size:10pt">        </span><span style="font-family:Arial;font-size:10pt">= 2; </span></font></p>

<p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">stat = ft_sourcestatistics(cfg, data1group{:},
data2group{:});</span></font></p><p class="MsoNormal"><font color="#000099"> <span style="font-family:Arial;font-size:10pt">stat.anatomy = data1group{1}.anatomy;</span></font></p><p></p>

<div>  </div><div>my computer (os 10.6.8, 6G memory) runs out of swap memory (startup memory?), which forces me to quit Matlab. I'm running above processes in a function, so I'm not running into Matlab memory error. </div>

<div><div><br></div><div>Could someone help me how it could run more efficiently? I guess cfg.inputfile is not available for ft_sourcestatistics, so I have to eventually load 2 group data in Matlab workspace...?</div><div>

<br></div><div>Thank you in advance! Akiko</div><div><br></div>-- <br><font><span style="font-family:arial,helvetica,sans-serif">Akiko Ikkai, Ph.D. <br>Postdoctoral Fellow<br style="font-family:arial,helvetica,sans-serif">

</span></font><font style="font-family:arial,helvetica,sans-serif" face="'PrimaSans BT,Verdana,sans-serif'">Department of 
Psychological and Brain Sciences<br>Johns Hopkins University<br>Ames 
Hall, 3400 N. Charles St.<br>Baltimore, MD 21218</font><br style="font-family:arial,helvetica,sans-serif"><br><br>
</div>