<div dir="ltr">Hello Fieldtrip community,<div><br></div><div>I'm trying to do source analysis on my EEG data and am following the <a href="https://www.fieldtriptoolbox.org/tutorial/minimumnormestimate/">Source reconstruction of event-related fields using minimum-norm estimation</a> tutorial. Since the tutorial is for MEG data, I followed the <a href="https://www.fieldtriptoolbox.org/workshop/oslo2019/forward_modeling/">Forward modeling for EEG source reconstruction</a> tutorial to compute my forward solution for EEG instead. As such, I wrote 2 MATLAB scripts: one called forward_model_eeg_pilot.m to do the forward modelling, and one called source_reconstruction_mne_pilot.m to do the inverse solution. Please find my code and output <a href="https://justpaste.it/1nvqt">here</a>.</div><div><br></div><div>In the inverse solution section I used the pre-computed leadfield from the other tutorial. The issue is that I get the following error once I call the ft_sourceanalysis function in line 67:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>Warning: the labels are missing for the precomputed leadfields, assuming that they were computed with the same channel</div><div>selection </div><div>Index exceeds the number of array elements (2).</div><div><br></div><div>Error in getdimord (line 468)</div><div> if isequalwithoutnans(datsiz, [npos nchan nori]) || (isequal(datsiz([1 3]), [npos nori]) && isinf(nchan))</div><div><br></div><div>Error in ft_selectdata (line 188)</div><div> dimord{i} = getdimord(varargin{1}, datfield{i});</div><div><br></div><div>Error in ft_sourceanalysis (line 435)</div><div> sourcemodel = ft_selectdata(tmpcfg, sourcemodel);</div><div><br></div><div>Error in source_reconstruction_mne_pilot (line 67)</div><div>sourceL = ft_sourceanalysis(cfg, tlckL);</div></blockquote><br><div>I also tried calculating the ft_sourceanalysis without the precomputed leadfield, by passing it the source model and head model and having it compute the forward solution on the fly. While no error is given when I did that, the
source output is still invalid, containing NaNs for all the entries in the avg.pow field.</div><div><br></div><div>I was wondering if anyone could give me some pointers on how to fix this issue. I've included the output of the source_reconstruction_mne_pilot.m script in the <a href="https://justpaste.it/1nvqt">link </a>for your reference. Any help is appreciated and thanks a lot in advance!</div><div><br></div><div>Jason</div><div><br></div><div><br></div></div>