Back to the main page.

Bug 2427 - ft_prepare_layout with = 'yes' opens two figures

Reported 2014-01-06 11:40:00 +0100
Modified 2014-03-12 12:19:56 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 minor
Assigned to: Jörn M. Horschig
Depends on:
See also:

Jörn M. Horschig - 2014-01-06 11:40:52 +0100

cfg = []; cfg.layout = 'mpi_customized_acticap64'; = 'yes'; lay = ft_prepare_layout(cfg); results in two figures to be opened with identical content. Probably is passed on to another function which also uses to provide feedback on the layout

Jörn M. Horschig - 2014-01-08 15:56:35 +0100

the problem is line 306 onwards: if isempty(strfind(cfg.layout, '.')) cfg.layout = [cfg.layout '.mat']; if exist(cfg.layout, 'file') fprintf('layout file without .mat (or .lay) extension specified, appending .mat\n'); layout = ft_prepare_layout(cfg); else cfg.layout = [cfg.layout(1:end-3) 'lay']; layout = ft_prepare_layout(cfg); end [...] Here, ft_prepare_layout gets called recursively. I propose to add return-statements.

Jörn M. Horschig - 2014-01-22 09:24:04 +0100

svn ci ft_prepare_layout.m -m "prevent feedback figure from being opened twice by returning after recursive statement" Sending ft_prepare_layout.m Transmitting file data . Committed revision 9120.