Back to the main page.

Bug 2459 - Error in ft_postamble_history > warning_once

Status CLOSED DUPLICATE
Reported 2014-01-28 18:48:00 +0100
Modified 2014-03-12 12:19:54 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: All
Operating System: All
Importance: P5 normal
Assigned to: Jörn M. Horschig
URL:
Tags:
Depends on:
Blocks:
See also:

Ian Andolina - 2014-01-28 18:48:10 +0100

Hi, I'm calling ft_timelockanalysis within a method in a class object called plxReader. When called from the commandline there is no errors but when the same commad is called from the function I get the following error: Invalid field name: 'plxReader.ftAnalysis'. Error in warning_once>fieldnameFromStack (line 196) ft_previous_warnings.(stack(end).name) = []; % iteratively build up structure fields Error in warning_once (line 123) [tmpfname ft_default.warning.identifier line] = fieldnameFromStack(ft_default.warning.identifier); Error in ft_postamble_history (line 55) warning_once('-clear'); Error in ft_postamble (line 55) evalin('caller', ['ft_postamble_' cmd]); Error in ft_timelockanalysis (line 371) ft_postamble history timelock Error in plxReader/ftAnalysis (line 213) av{i} = ft_timelockanalysis(cfg,ft); The class.method name in the stack causes the error.


Ian Andolina - 2014-01-29 10:48:54 +0100

I've fixed this for my needs by the following: diff --git a/utilities/private/warning_once.m b/utilities/private/warning_once.m index 33f9f27..d930ef2 100644 --- a/utilities/private/warning_once.m +++ b/utilities/private/warning_once.m @@ -193,7 +193,8 @@ end fname = horzcat(stack(end).name); if ~issubfield(ft_previous_warnings, stack(end).name) - ft_previous_warnings.(stack(end).name) = []; % iteratively build up structure fields + name = regexprep(stack(end).name,'\.',''); + ft_previous_warnings.(name) = []; % iteratively build up structure fields end


Jörn M. Horschig - 2014-01-29 13:20:57 +0100

Hi Ian, thanks for reporting and providing a tentative fix. I'll look into this now and will report back on how we solved this :) *** This bug has been marked as a duplicate of bug 2407 ***


Jörn M. Horschig - 2014-01-29 13:54:02 +0100

fixed in a slightly more generic way by fname = regexprep(fname,'[^a-zA-Z0-9]',''); thanks very much for reporting this!


Ian Andolina - 2014-01-29 13:57:25 +0100

Cool, no problem a good regex can't fix ;-)