Back to the main page.

Bug 640 - make trialfun, statfun and browsefun behave consistently

Reported 2011-05-04 14:55:00 +0200
Modified 2012-08-23 10:35:13 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P1 enhancement
Assigned to: Eelke Spaak
Depends on: 14341435
See also:

Robert Oostenveld - 2011-05-04 14:55:06 +0200

Robert Oostenveld - 2011-05-10 20:54:08 +0200

this affects the following functions ft_definetrial statistics_analytic statistics_montecarlo private/prepare_design (is this still in use?) statistics_stats (should be removed anyway)

Robert Oostenveld - 2011-05-10 20:59:38 +0200


Robert Oostenveld - 2011-05-10 21:22:48 +0200

Committed revision 3495 with % provide support for xxx and trialfun_xxx when the user specifies cfg.trialfun=xxx if exist(cfg.trialfun, 'file') % evaluate this function, this is the default elseif exist(['trialfun_' cfg.trialfun], 'file') % prepend trialfun to the function name cfg.trialfun = ['trialfun_' cfg.trialfun]; else error('cannot locate the specified trialfun (%s)', cfg.trialfun) end

Eelke Spaak - 2012-08-06 16:06:12 +0200

There is now (rev 6327 onwards) a utilities/ft_getuserfun function that attempts to fetch a function based on user-specified input. It will always return a function handle, and supports either a function handle or a string as input. Also a prefix (e.g. 'trialfun') is supported; and always 'ft_' as an additional prefix will be tested as well. Done: ft_definetrial ft_statistics_analytic ft_statistics_montecarlo To do: ft_databrowser Unsure: private/prepare_design ft_statistics_stats Both the 'Unsure' functions never try to fetch a function (i.e. statfun) based on a specified string, so I don't think this bug applies to them. And, it seems that the code is pretty much legacy anyway.

Eelke Spaak - 2012-08-06 16:17:11 +0200

Fixed in ft_databrowser as well (rev 6331, see lines 467-473 for relevant code).

Robert Oostenveld - 2012-08-06 16:24:55 +0200

please move utilities/ft_getuserfun to private/ft_getuserfun (and when needed to other private directories). It is not a function that should be called by normal users and therefore not an end-user utility.

Eelke Spaak - 2012-08-06 16:28:44 +0200

bash-3.2$ svn commit private utilities Adding private/ft_getuserfun.m Adding private/iscompatwrapper.m Adding private/isfunction.m Deleting utilities/ft_getuserfun.m Deleting utilities/private/iscompatwrapper.m Deleting utilities/private/isfunction.m Committed revision 6332.

Eelke Spaak - 2012-08-23 10:35:13 +0200

closing my bugs