<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Dear all, <div class=""><br class=""></div><div class="">I am trying to perform a source reconstruction on EEG data acquired with a Biosemi system with 64 electrodes. I am experiencing two issues at the moment, one associated to whether or not my source_model is correct (see figure in attachement) or not and the second one is a mistake associated with the code.</div><div class=""><br class=""></div><div class="">Here is the code I am using:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% cfg=[];</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% cfg.layout='biosemi64.lay';</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% d=ft_prepare_layout(cfg);</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% </div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% q=struct2cell(d);</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% </div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% zeroline = 92/40*50;</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% </div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% q{65,1} = 'nasion';</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% q{65,2} = zeroline; %ten percent under FPz</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% q{65,3} = q{33,3};</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% </div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% q{66,1} = 'inion';</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% q{66,2} = zeroline; %ten percent under Oz</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% q{66,3} = q{29,3};</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% </div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% q{67,1} = 'left';</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% q{67,2} = -zeroline; %ten percent under T7</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% q{67,3} = q{15,3};</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% </div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% q{67,1} = 'right';</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% q{67,2} = zeroline; %ten percent under T8</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% q{67,3} = q{52,3};</div></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">q=biosim64;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">ph = table2array(q(:,2));</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">th = table2array(q(:,3));</div><p style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">x = sin(ph*pi/180) .* cos(th*pi/180);</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">y = sin(ph*pi/180) .* sin(th*pi/180);</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">z = cos(ph*pi/180);</div><p style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">plot3(x, y, z, <span style="color: #b245f3" class="">'.'</span>);</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">elec.label = q(:,1);</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">elec.pnt = [x y z];</div><p style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.sourcemodel.pos = elec.pnt;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">sourcemodel = ft_prepare_sourcemodel(cfg);</div><p style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243);" class=""><span style="color: #000000" class="">vol = ft_read_headmodel(</span>'headmodel/standard_bem.mat'<span style="color: #000000" class="">);</span></div><p style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">% realign electrodes to headmodel</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg = [];</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.method = <span style="color: #b245f3" class="">'interactive'</span>;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.elec = elec;</div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">cfg.headshape = vol.bnd(1); <span style="color: #25992d" class="">%1 = skin</span></div><div style="margin: 0px; font-size: 10px; font-family: Courier;" class="">elec = ft_electroderealign(cfg);</div><p style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);" class="">%save new electrodes</div><div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243);" class=""><span style="color: #000000" class="">save </span>elec64.mat<span style="color: #000000" class=""> </span>elec</div></div><div class=""><br class=""></div><div class="">When I run the plot of the source model, it gives the output in attachement. But I really have no cue whether or not it sounds correct since this is the first time I am running this.</div><div class=""><br class=""></div><div class="">Then, we I run the ft_electroderealign, I have the following error message:</div><div class=""><div class=""><font color="#e32400" class="">Error using table/length (line 419)</font></div><div class=""><font color="#e32400" class="">Undefined function 'length' for input arguments of type 'table'.  Use the HEIGHT, WIDTH,</font></div><div class=""><font color="#e32400" class="">or SIZE functions instead.</font></div><div class=""><br class=""></div><div class="">Do you have an easy solution to solve this? I could of course change the code in the ft_electroderealign but it’s probably not a good idea.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><u class="">((((((((((other option:</u></div><div class=""><br class=""></div><div class="">I also tried to run it differently with what is in green (commented) based on an another example that I have found online (see <a href="http://www.fieldtriptoolbox.org/example/biosemi/#modify-layout-file" class="">http://www.fieldtriptoolbox.org/example/biosemi/#modify-layout-file</a>). </div><div class="">If I just use the same example it first lead to a mistake saying that <font color="#e32400" class="">Cell contents assignment to a non-cell array object. </font>while it is exactly what is mentioned online.<font color="#e32400" class=""> </font></div><div class="">If I use a struct2cell q=struct2cell(d);, then I have the following error message <font color="#b51a00" class="">Index exceeds matrix dimensions.</font>))))))))))))</div><div class=""><br class=""></div><div class=""><b class="">I am thus stuck with several different mistakes and since I have no one around who did this before, I am a bit lost on what to do and if what I am currently doing is correct.</b></div><div class=""><b class="">Thank you in advance!</b></div><div class=""><b class="">Emilie</b></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><img height="494" width="918" apple-width="yes" apple-height="yes" apple-inline="yes" id="CC25BCCE-C68C-4D6F-B852-E67476AA7287" src="cid:05506C33-F792-4EDE-BF5F-F2351FF50563@home" class=""></div><div apple-content-edited="true" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div></div></div></div></div></div></div></div></div></div></body></html>