<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Dear Patrick,
<div class=""><br class="">
</div>
<div class="">Just to be sure: can you get the latest release version of the code and try whether this error persists (e.g. <a href="http://github.com/fieldtrip/fieldtrip/releases/tag/20200911" class="">http://github.com/fieldtrip/fieldtrip/releases/tag/20200911</a>)?
The reason I ask is that your reported line number (i.e. line 217 in ft_sourcenalasysis) that throws the error does not match the current state of the code. I’d like to be sure that this is a genuine error, or that you happen to have stumbled upon a dysfunctional
version (for which we humbly apologize :) ).</div>
<div class="">
<div><br class="">
</div>
<div>Best wishes,</div>
<div>Jan-Mathijs</div>
<div><br class="">
</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 15 Sep 2020, at 10:55, Patrick Wiegel <<a href="mailto:patrick.wiegel@sport.uni-freiburg.de" class="">patrick.wiegel@sport.uni-freiburg.de</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Dear Fieldtrip community,
<div class=""><br class="">
</div>
<div class="">I am a PhD student from Germany and I am working with EEG data. I would like to do Beamformer source analyses on power data. </div>
<div class=""><br class="">
</div>
<div class="">I don’t have individual MRIs or related electrode positions available, so I am taking the standard MRI and BEM headmodel from the fieldtrip templates. Doing the source_analyses, I am getting an error message. Can anyone tell me if I missed something
and what the reason for that error is? The error appears when running the last part of the script ft_sourceanalyses:</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">the input is freq data with 64 channels, 1 frequencybins and no timebins</div>
<div class="">Undefined function or variable 'fieldname'.</div>
<div class=""><br class="">
</div>
<div class="">Error in ft_checkconfig (line 307)</div>
<div class=""> for i=1:length(fieldname)</div>
<div class=""><br class="">
</div>
<div class="">Error in ft_sourceanalysis (line 217)</div>
<div class="">cfg = ft_checkconfig(cfg, 'createtopcfg', cfg.method);</div>
<div class=""><br class="">
</div>
<div class="">Error in BEAMformer (line 116)</div>
<div class="">sourceAll = ft_sourceanalysis(cfg, frequ_all);</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
</div>
<div class="">I added my code below. I would appreciate any help. I added information on my existing variables below the code.</div>
<div class=""><br class="">
</div>
<div class="">Best, Patrick</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(34, 139, 34);" class="">
%% import EEG data</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
EEG_Data = eeglab2fieldtrip( EEG, <span style="color: #a020f0" class="">'raw'</span>,
<span style="color: #a020f0" class="">'none'</span> );</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(34, 139, 34);" class="">
%% define trials for frequency analyses</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.trials = Indexes_correct{1, 1};</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.toilim = [0.25 0.55];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
data_fed_correct = ft_redefinetrial(cfg, EEG_Data);</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.trials = Indexes_incorrect{1, 1};</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.toilim = [0.25 0.55];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
data_fed_incorrect = ft_redefinetrial(cfg, EEG_Data);</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(34, 139, 34);" class="">
%% run frequenc analyses</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.method = <span style="color: #a020f0" class="">'mtmfft'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.output = <span style="color: #a020f0" class="">'powandcsd'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.tapsmofrq = 4;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.foilim = [25 25];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
frequ_correct = ft_freqanalysis(cfg, data_fed_correct);</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.method = <span style="color: #a020f0" class="">'mtmfft'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.output = <span style="color: #a020f0" class="">'powandcsd'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.tapsmofrq = 4;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.foilim = [25 25];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
frequ_incorrect = ft_freqanalysis(cfg, data_fed_incorrect);</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.method = <span style="color: #a020f0" class="">'mtmfft'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.output = <span style="color: #a020f0" class="">'powandcsd'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.tapsmofrq = 4;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.foilim = [25 25];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
frequ_all = ft_freqanalysis(cfg,EEG_Data);</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(34, 139, 34);" class="">
%% load MRI and BEM templates</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(160, 32, 240);" class="">
<span style="" class="">load(</span>'/Users/patrickwiegel/Documents/MATLAB/Scripts/2020/TF_Data/fieldtrip-20200603/template/headmodel/standard_bem.mat'<span style="" class="">)</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(160, 32, 240);" class="">
<span style="" class="">load(</span>'/Users/patrickwiegel/Documents/MATLAB/Scripts/2020/TF_Data/fieldtrip-20200603/template/headmodel/standard_mri.mat'<span style="" class="">)</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(34, 139, 34);" class="">
%% segment mri </div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.write = <span style="color: #a020f0" class="">'no'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
[segmentedmri] = ft_volumesegment(cfg, mri);</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
disp(segmentedmri)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(34, 139, 34);" class="">
%% </div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
mri = ft_volumereslice(cfg, segmentedmri);</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
display(mri)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(34, 139, 34);" class="">
%% align electrodes</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(160, 32, 240);" class="">
<span style="" class="">load(</span>'elec_aligned'<span style="" class="">)</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
elec_aligned = ft_convert_units(elec_aligned, <span style="color: #a020f0" class="">
'cm'</span>);</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(34, 139, 34);" class="">
<span style="" class="">vol = ft_convert_units(vol, </span><span style="color: #a020f0" class="">'cm'</span><span style="" class="">);
</span>% Convert the vol to cm, because the CTF convenction is to express everything in cm.</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(34, 139, 34); min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(34, 139, 34);" class="">
%%</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
[headmodel, elec_aligned]=ft_prepare_vol_sens (vol,elec_aligned);</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.method = <span style="color: #a020f0" class="">'interactive'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.elec = elec_aligned;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.headshape = headmodel.bnd(1);</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
elec_aligned = ft_electroderealign(cfg);</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(34, 139, 34);" class="">
%%</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(34, 139, 34);" class="">
% construct the dipole grid in the template brain coordinates</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(34, 139, 34);" class="">
% the negative inwardshift means an outward shift of the brain surface for inside/outside detection</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.resolution = 1;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.tight = <span style="color: #a020f0" class="">'yes'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.inwardshift = -1.5;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.headmodel = headmodel;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
sourcemodel = ft_prepare_sourcemodel(cfg);</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
<br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(34, 139, 34);" class="">
%%</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.method = <span style="color: #a020f0" class="">'dics'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.frequency = 25;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.sourcemodel = sourcemodel;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.headmodel = headmodel;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.elec = elec_aligned;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.dics.projectnoise = <span style="color: #a020f0" class="">'yes'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.dics.lambda = <span style="color: #a020f0" class="">'5%'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.dics.keepfilter = <span style="color: #a020f0" class="">'yes'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.dics.realfilter = <span style="color: #a020f0" class="">'yes'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
sourceAll = ft_sourceanalysis(cfg, frequ_all);</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">sourcemodel = </div>
<div class=""><br class="">
</div>
<div class=""> struct with fields:</div>
<div class=""><br class="">
</div>
<div class=""> dim: [17 22 18]</div>
<div class=""> pos: [6732×3 double]</div>
<div class=""> unit: 'cm'</div>
<div class=""> inside: [6732×1 logical]</div>
<div class=""> cfg: [1×1 struct]</div>
</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">elec_aligned = </div>
<div class=""><br class="">
</div>
<div class=""> struct with fields:</div>
<div class=""><br class="">
</div>
<div class=""> chanpos: [64×3 double]</div>
<div class=""> chantype: {64×1 cell}</div>
<div class=""> chanunit: {64×1 cell}</div>
<div class=""> elecpos: [64×3 double]</div>
<div class=""> homogeneous: [4×4 double]</div>
<div class=""> label: {1×64 cell}</div>
<div class=""> tra: [64×64 double]</div>
<div class=""> type: 'eeg1010'</div>
<div class=""> unit: 'cm'</div>
<div class=""> cfg: [1×1 struct]</div>
</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">headmodel = </div>
<div class=""><br class="">
</div>
<div class=""> struct with fields:</div>
<div class=""><br class="">
</div>
<div class=""> bnd: [1×3 struct]</div>
<div class=""> cond: [0.3300 0.0041 0.3300]</div>
<div class=""> mat: [64×3000 double]</div>
<div class=""> type: 'dipoli'</div>
<div class=""> unit: 'cm'</div>
<div class=""> skin_surface: 1</div>
<div class=""> inner_skull_surface: 3</div>
<div class=""> source: 3</div>
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
</div>
<div class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<b class="">Patrick Wiegel</b><br class="">
<font color="#680823" class="">Department of Sport and Sport Science</font>
<div class=""><br class="">
University of Freiburg <br class="">
Sandfangweg 4<br class="">
79117 Freiburg i. Br . <br class="">
<br class="">
<div class="">phone: +49 (0)761/ 203-4550<br class="">
<a href="mailto:patrick.wiegel@sport.uni-freiburg.de" class="">email: patrick.wiegel@sport.uni-freiburg.de</a><br class="">
web: <a href="http://www.sport.uni-freiburg.de" class="">www.sport.uni-freiburg.de</a></div>
</div>
</div>
</div>
<br class="">
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
https://doi.org/10.1371/journal.pcbi.1002202<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>