<div dir="ltr"><div><div>Dear all<br><div>I am creating a BEM model for eeg, following the appropriate tutorial, but I have a problem when preparing the headmodel. The output I have from the ft_prepare_headmodel command does not contain the "mat", and so, when I try to generate the leadfield, it returns an error message due to non existent "mat". I saw that other users had similar problem, but I haven't found a solution though. So, what is wrong with my script?</div>
<div><br></div><div>Thanks a lot in advance!</div><div>Best,</div><div>Ricardo</div></div></div><div><br><br><br><br>load standard_mri.mat<br>mri_orig=mri;<br>disp(mri)<br><br>% Segmenting the data<br>cfg = [];<br>cfg.output= {'scalp','skull','brain'};<br>

segmentedmri  = ft_volumesegment(cfg, mri_orig);<br>disp(segmentedmri)<br>save segmentedmri segmentedmri<br><br>% MESH <br>cfg=[];<br>cfg.tissue={'brain','skull','scalp'};<br>cfg.numvertices = <a href="tel:%5B3000%202000" value="+5530002000" target="_blank">[3000 2000</a> 1000];<br>

bnd=ft_prepare_mesh(cfg,segmentedmri);<br>disp(bnd(1))   <br><br>% Head Model = variavel vol<br>cfg        = [];<br>cfg.method ='bem_dipoli'; %dipoli singlesphere<br>vol        = ft_prepare_headmodel(cfg, segmentedmri); <br>
<br><br>>> disp(vol)<br></div>             bnd: [1x3 struct]<br>            cond: [0.3300 0.0041 0.3300]<br>    skin_surface: 1<br>          source: 3<br>
            type: 'dipoli'<br>            unit: 'mm'<br>             cfg: [1x1 struct]<br><br><div><br><br></div></div>