<div dir="ltr">Hello All again!<div><br></div><div>I have read some articles and i have a question about using ft_sourceanalysis. </div><div><br></div><div>I don't want to perform source analysis on averaged data from all epochs, because  i want to create a matrix where i will have reconstructed source data for each ROI from atlas. I need my data to be epoched, and not power, since i want to do multiple operations on this matrix. So the matrix will look like</div><div>ROI 1 signal value for 1st time point | signal value for 2nd time point .....</div><div>ROI 2 signal value for 1st time point | signal value for 2nd time point .....</div><div>ROI 3 signal value for 1st time point | signa value for 2nd time point .....</div><div><br></div><div>In this situation should i do the source analysis in loop separately for all trials? I did not see this approach in any tutorial (if there is one like that i didnt found it). Is it a good idea?</div><div> I understand that ft_sourceanalysis perform source analysis on averaged data from default, but if i pass separate epochs in loop and then concatenate the source data can i then perform interpolation and parcellation to atlas each epoch separately? <br></div><div>I want to do this for baseline period and stimulus period separately, so i can then compare if there were any significant changes. </div><div><br></div><div>I also wonder if there maybe is some quicker approach, since on my computer ft_sourceanalysis is taking long time even for one epoch (i have 19 electrodes and computing each one is taking long), so if i have 1000 epochs it will take hours to complete.</div><div><br></div><div>If this is complete nonsense please let me know.</div><div>Im passing my loop code below.</div><div><br></div><div>Best regards and thank you for your help.</div><div>Monika</div><div><br></div><div><br></div><div><br></div><div>%%%code</div><div><div class="gmail-rtcContent" style="padding:30px"><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre"><span style="color:rgb(0,128,19)">%that is only for baseline, the same idea will go to stimulus data</span></span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">source_baseline_all = cell(1, length(data_baseline.trial));</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">source_stimulus_all = cell(1, length(data_stimulus.trial));</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre"><span style="color:rgb(0,128,19)">%source analysis for each trial</span></span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre"><span style="color:rgb(14,0,255)">for </span>i = 1:length(data_baseline.trial)</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">    <span style="color:rgb(0,128,19)">%creating temporary structure containing only one trial in loop</span></span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">    temp_data = data_baseline;</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">    temp_data.trial = {data_baseline.trial{i}};</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">    temp_data.time = {data_baseline.time{i}};</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">    temp_data.sampleinfo = data_baseline.sampleinfo(i, :);</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">    temp_data.trialinfo = data_baseline.trialinfo(i, :);</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">    </span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">    cfg = [];</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">    cfg.method = <span style="color:rgb(167,9,245)">'lcmv'</span>;</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">    cfg.headmodel = headmodel;</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">    cfg.sourcemodel = sourcemodel;</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">    cfg.lcmv.keepfilter = <span style="color:rgb(167,9,245)">'yes'</span>;</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">    cfg.lcmv.fixedori = <span style="color:rgb(167,9,245)">'yes'</span>;</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">    source_baseline_all{i} = ft_sourceanalysis(cfg, temp_data);</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre"><span style="color:rgb(14,0,255)">end</span></span></div></div></div><div><br></div></div>