<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} .ms-cui-menu {background-color:#ffffff;border:1px rgb(171, 171, 171) solid;font-family:'Segoe UI WPC', 'Segoe UI', Tahoma, 'Microsoft Sans Serif', Verdana, sans-serif;font-size:11pt;color:rgb(51, 51, 51);} .ms-cui-menusection-title {display:none;} .ms-cui-ctl {vertical-align:text-top;text-decoration:none;color:rgb(51, 51, 51);} .ms-cui-ctl-on {background-color:rgb(223, 237, 250);opacity: 0.8;} .ms-cui-img-cont-float {display:inline-block;margin-top:2px} .ms-cui-smenu-inner {padding-top:0px;} .ms-owa-paste-option-icon {margin: 2px 4px 0px 4px;vertical-align:sub;padding-bottom: 2px;display:inline-block;} .ms-rtePasteFlyout-option:hover {background-color:rgb(223, 237, 250) !important;opacity:1 !important;} .ms-rtePasteFlyout-option {padding:8px 4px 8px 4px;outline:none;} .ms-cui-menusection {float:left; width:85px;height:24px;overflow:hidden}.wf {speak:none; font-weight:normal; font-variant:normal; text-transform:none; -webkit-font-smoothing:antialiased; vertical-align:middle; display:inline-block;}.wf-family-owa {font-family:'o365Icons'}@font-face {  font-family:'o365IconsIE8';  src:url('https://r4.res.outlook.com/owa/prem/15.0.913.9/resources/styles/office365icons.ie8.eot?#iefix') format('embedded-opentype'),         url('https://r4.res.outlook.com/owa/prem/15.0.913.9/resources/styles/office365icons.ie8.woff') format('woff'),         url('https://r4.res.outlook.com/owa/prem/15.0.913.9/resources/styles/office365icons.ie8.ttf') format('truetype');  font-weight:normal;  font-style:normal;}@font-face {  font-family:'o365IconsMouse';  src:url('https://r4.res.outlook.com/owa/prem/15.0.913.9/resources/styles/office365icons.mouse.eot?#iefix') format('embedded-opentype'),         url('https://r4.res.outlook.com/owa/prem/15.0.913.9/resources/styles/office365icons.mouse.woff') format('woff'),         url('https://r4.res.outlook.com/owa/prem/15.0.913.9/resources/styles/office365icons.mouse.ttf') format('truetype');  font-weight:normal;  font-style:normal;}.wf-family-owa {font-family:'o365IconsMouse'}.ie8 .wf-family-owa {font-family:'o365IconsIE8'}.ie8 .wf-owa-play-large:before {content:'\e254';}.notIE8 .wf-owa-play-large:before {content:'\e054';}.ie8 .wf-owa-play-large {color:#FFFFFF/*$WFWhiteColor*/;}.notIE8 .wf-owa-play-large {border-color:#FFFFFF/*$WFWhiteColor*/; width:1.4em; height:1.4em; border-width:.1em; border-style:solid; border-radius:.8em; text-align:center; box-sizing:border-box; -moz-box-sizing:border-box; padding:0.1em; color:#FFFFFF/*$WFWhiteColor*/;}.ie8 .wf-size-play-large {width:40px; height:40px; font-size:30px}.notIE8 .wf-size-play-large {width:40px; height:40px; font-size:30px}--></style>
</head>
<body dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p style="">Hello fieldtrip,<br>
</p>
<p style=""><br>
</p>
<p style="">I am trying to perform an LCMV beamformer on timelockanalysis data.<br>
</p>
<p style=""><br>
</p>
<p style="">timelock = <br>
</p>
<div>       avg: [124x20517 double]</div>
<div>       var: [124x20517 double]</div>
<div>      time: [1x20517 double]</div>
<div>       dof: [124x20517 double]</div>
<div>     label: {1x124 cell}</div>
<div>    dimord: 'chan_time'</div>
<div>       cov: [124x124 double]</div>
<div>      elec: [1x1 struct]</div>
<div style="">       cfg: [1x1 struct]<br>
</div>
<div style=""><br>
</div>
<div style="">I first run ft_prepare_leadfield<br>
</div>
<div style=""><br>
</div>
<div style="">
<div style=""><span>    </span><span>    </span><span>    </span>cfg                 = [];</div>
<div>            cfg.elec            = timelock.elec;</div>
<div>            cfg.vol             = vol;</div>
<div style=""><span style="font-size: 12pt;">            cfg.grid.resolution = 1;   % use a 3-D grid with a 1 cm resolution</span><br>
</div>
<div>            cfg.grid.unit       = 'cm';</div>
<div>            cfg.normalize       = 'yes'; % if you are not contrasting the activity of interest again another condition or baseline time-window</div>
<div style="">            grid = ft_prepare_leadfield( cfg);<br>
</div>
<div style=""><br>
</div>
<div style="">grid = <br>
</div>
<div style="">
<div>        xgrid: [-5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8]</div>
<div>        ygrid: [-6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7]</div>
<div>        zgrid: [0 1 2 3 4 5 6 7 8 9 10 11 12]</div>
<div>          dim: [14 14 13]</div>
<div>          pos: [2548x3 double]</div>
<div>         unit: 'cm'</div>
<div>       inside: [1x1409 double]</div>
<div>      outside: [1x1139 double]</div>
<div>          cfg: [1x1 struct]</div>
<div style="">    leadfield: {1x2548 cell}<br>
</div>
<div style=""><br>
</div>
<div style="">I then try to run the ft_sourceanalysis code:<br>
</div>
<div style="">
<div style=""><span style="font-size: 12pt;">            </span></div>
<div style="">
<div style=""><span>    </span><span>    </span><span>    </span>cfg              = [];</div>
<div>            cfg.channel = timelock.label;</div>
<div>            cfg.method       = 'lcmv';</div>
<div>            cfg.grid = grid;</div>
<div>            cfg.vol          = vol;</div>
<div>            cfg.keepfilter = 'yes';</div>
<div style="">            source = ft_sourceanalysis( cfg, timelock);<br>
</div>
<br>
</div>
<br>
</div>
And it crashes with the error message:<br>
</div>
<div style=""><br>
</div>
<div style="">
<div>Error using  * </div>
<div>Inner matrix dimensions must agree.</div>
<div><br>
</div>
<div>Error in beamformer_lcmv (line 268)</div>
<div>    filt = pinv(lf' * invCy * lf) * lf' * invCy;              % van Veen eqn. 23, use PINV/SVD to</div>
<div>    cover rank deficient leadfield</div>
<div><br>
</div>
<div>Error in ft_sourceanalysis (line 794)</div>
<div style="">      dip(i) = beamformer_lcmv(grid, sens, vol, squeeze_avg, squeeze(Cy(i,:,:)), optarg{:});<br>
</div>
<div style=""><br>
</div>
<div style=""><br>
</div>
<div style=""><br>
</div>
<div style="">However, the code does work if it is:<br>
</div>
<div style=""><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">
<span>    </span><span>    </span><span>    </span>cfg              = [];</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">
            cfg.channel = timelock.label;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">
            cfg.method       = 'lcmv';</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">
            cfg.grid.inside = grid.inside;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">
            cfg.vol          = vol;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">
            cfg.keepfilter = 'yes';</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">
            source = ft_sourceanalysis( cfg, timelock);<br>
</div>
<br>
</div>
However, I run the sourceplot code produces something that looks like the picture attached.<br>
</div>
<div style=""><br>
</div>
<div style="">What is interesting is that when I run the interp code:<br>
</div>
<div style=""><br>
</div>
<div style="">
<div style=""><span>    </span>the input is source data with 16777216 positions on a [256 256 256] grid</div>
<div style=""><span>    </span>not plotting anatomy<br>
</div>
</div>
<div style=""><br>
</div>
<div style="">But when you run the same code from sourcePost_nocon from the beamformer tutorial,  you get the following when you run the code:<br>
</div>
<div style=""><br>
</div>
<div style="">
<div style=""><span>    </span>the input is source data with 3042 positions on a [18 13 13] grid</div>
<div style=""><span>    </span>the input is volume data with dimensions [256 256 256]<br>
</div>
<div style=""><br>
</div>
<div style="">I have used the same mri file for both.<br>
</div>
​<br>
</div>
<div style="">Please help, I cant work out the issue.<br>
</div>
<div style=""><br>
</div>
<div style="">Tyler<br>
</div>
<p style=""><br>
</p>
<div>
<p><br>
</p>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-size:13px">*************************
<div style="font-family:Tahoma"><br>
</div>
<div><font face="Arial"><i>Tyler Grummett ( BBSc, BSc(Hons I))</i></font></div>
<div><font face="Arial"><i>PhD Candidate</i></font></div>
<div><font face="Arial"><i>Brain Signals Laboratory</i></font></div>
<div><font face="Arial"><i>Flinders University</i></font></div>
<div><font face="Arial"><i>Rm 5A301</i></font></div>
<div><font face="Arial"><i>Ext 66124</i></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>