Back to the main page.

Bug 541 - try-catch construction incompatibe with matlab74

Reported 2011-03-22 11:39:00 +0100
Modified 2011-03-31 14:13:59 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P1 normal
Assigned to: Robert Oostenveld
Depends on:
See also:

Robert Oostenveld - 2011-03-22 11:39:27 +0100

The following was detected to be incompatible with matlab74 on a windows laptop (from Francesco), which I could confirm with the mac version of 74. cfg = []; cfg.dataset = 'Subject01.ds'; cfg.trialdef.eventtype = 'backpanel trigger'; cfg.trialdef.eventvalue = 3; % the value of the stimulus trigger for fully incongruent (FIC). cfg.trialdef.prestim = 1; % in seconds cfg.trialdef.poststim = 2; % in seconds cfg = ft_definetrial(cfg); this results in the warning/error message on screen > In ft_definetrial at 97 evaluating trialfunction 'trialfun_general' ??? Warning: File: /Users/robert/Desktop/course/fieldtrip-20110304/fileio/ft_read_header.m Line: 1020 Column: 15 This try-catch syntax will continue to work in R2007a, but may be illegal or may mean something different in future releases of MATLAB. See Release Notes for MATLAB Version 7.4, "Warning Generated by try-catch" for details. Error in ==> trialfun_general at 55 hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat); Error in ==> ft_definetrial at 128 [trl, event] = feval(cfg.trialfun, cfg);

Robert Oostenveld - 2011-03-22 11:54:41 +0100

It is a MATLAB version specific bug in MATLAB itself. See and

Robert Oostenveld - 2011-03-22 11:58:13 +0100

the following two code snippets demonstrate the problem try % do something catch me % solve the problem end try % do something error('something'); catch me = lasterror; % solve the problem end The first one has the problem on matlab74. On a more recent matlab version (7.10, R2010a) both code snippets work exactly the same, so replacing all occuring patterns of version one above by version two should allow matlab74 to be used.

Robert Oostenveld - 2011-03-22 12:24:20 +0100

This problem applies to the following functions ./fileio/ft_compile_fileio.m:catch me ./fileio/ft_read_header.m: catch me ./forward/ft_compile_forward.m:catch me ./ft_compile_mex.m:catch me ./ft_componentanalysis.m: catch ME ./ft_prepare_leadfield.m: catch ME ./peer/peercellfun.m:catch nargout_err ./peer/peercellfun.m: catch ME ./peer/peerexec.m: catch nargout_error ./peer/private/setcustompwd.m: catch cd_error ./realtime/acquisition/biosemi/acquire.m:catch me ./realtime/online_mri/ft_omri_quality.m: catch me I have changed it in all of these functions, the example preprocessing from the tutorial now again runs on matlab74. MacBook> svn commit Sending fileio/ft_read_header.m Sending ft_compile_mex.m Sending ft_componentanalysis.m Sending ft_prepare_leadfield.m Sending peer/peercellfun.m Sending peer/peerexec.m Sending peer/private/setcustompwd.m Sending realtime/acquisition/biosemi/acquire.m Sending realtime/online_mri/ft_omri_quality.m Transmitting file data ......... Committed revision 3184.

Robert Oostenveld - 2011-03-31 14:13:59 +0200

changed the status of most recently resolved/fixed bugs into "CLOSED"