Back to the main page.

Bug 3100 - Aerospace Blockset matlab toolbox interfere with built-in function "exist.m"

Reported 2016-03-20 10:47:00 +0100
Modified 2019-08-10 12:32:34 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 normal
Assigned to: Diego Lozano Soldevilla
Depends on:
See also:

Diego Lozano Soldevilla - 2016-03-20 10:47:23 +0100

Turns out I've the Aerospace Blockset matlab toolbox ( installed in my windows machine ( (R2009b)). Using ft_plot_dipole.m I got an error in fieldtrip/plotting/private/refine.m function line 63: if exist('texture') The output is 7, which means there's a directory with the name "texture", and indeed the aeroblks toolbox has one: C:\Program Files (x86)\MATLAB\R2009b\toolbox\aeroblks\aerodemos\texture SOLUTION: I would be more strict when using exist.m function, using the second argument to avoid confusions between the name of a workspace variable names and unwanted paths with same name: if exist('texture','var') Looking forward to hear your suggestions

Robert Oostenveld - 2016-03-20 10:49:46 +0100

agreed, we should always used the 2nd input to make sure that we are checking for the existence of a file or a variable. Let me CC Simon, who wrote the specific code.

Robert Oostenveld - 2016-04-28 15:44:17 +0200

Let me finalize this In the top level directory I found these ft_artifact_zvalue.m:if exist('tmpKey') ft_freqstatistics.m:if exist(['ft_statistics_' cfg.method]) ft_multiplotCC.m: if exist('tmpdata'), ft_sourcestatistics.m:if exist(['ft_statistics_' cfg.method]) ft_timelockstatistics.m:if exist(['ft_statistics_' cfg.method]) mac011> git commit -a [bug3100-exist d0d1aad] ENH - always use 2nd input argument for exist() function, see 5 files changed, 15 insertions(+), 13 deletions(-)

Robert Oostenveld - 2016-04-28 15:53:11 +0200

(In reply to Robert Oostenveld from comment #2) it gets a bit more messy one level down, but I found some more mac011> git commit -a [bug3100-exist 1c4f02a] ENH - use two input arguments for exist() function, see 4 files changed, 7 insertions(+), 7 deletions(-)

Robert Oostenveld - 2016-04-28 15:56:22 +0200

I made all changes and merged with the master

Diego Lozano Soldevilla - 2016-04-28 16:19:07 +0200

(In reply to Robert Oostenveld from comment #4) thank you so much!

Robert Oostenveld - 2019-08-10 12:32:34 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on