Error in contains.m (plot sources)

Hi, I updated Brainstorm (and also MATLAB, now R2019b) and now I'm encountering this error when opening source plots (TF and stats, which were already in my protocol):

2019-11-27_100645

Any idea what this could be?
Thanks

EDIT: Now I see I have a very similar problem with 2D plots too. This time the error appears in the MATLAB console, not in bst report viewer:

Error using strfind
PATTERN must be a string scalar or character vector.

Error in contains (line 36)
tf = ~cellfun(@isempty, strfind(s, pattern));

Error in matlab.ui.internal.prepareFigureFor

Error in zoom (line 242)
    matlab.ui.internal.prepareFigureFor(f, mfilename('fullpath'));

Error in figure_3d>CreateFigure (line 110)
            z = zoom(hFig);

Error in figure_3d (line 44)
eval(macro_method);

Error in bst_figures>CreateFigure (line 172)
                hFig = figure_3d('CreateFigure', FigureId);

Error in bst_figures (line 60)
eval(macro_method);

Error in view_topography (line 256)
    [hFig, iFig, isNewFig] = bst_figures('CreateFigure', iDS, FigureId, CreateMode, DataFile);

Error in tree_callbacks>@(h,ev)view_topography(FileName,AllMod{iMod},'2DDisc',[],UseSmoothing,hFig) (line 2779)
                    gui_component('MenuItem', jSubMenu, [], '2D Disc',       IconLoader.ICON_TOPOGRAPHY, [],
                    @(h,ev)view_topography(FileName, AllMod{iMod}, '2DDisc',      [], UseSmoothing, hFig));

EDIT 2: With MATLAB R2018a it works fine.

Hi Simone,

From the Brainstorm point of view, this error seems to be coming from a call to the Matlab zoom() function:

z = zoom(hFig);

Everything following this call in the stack trace is internal to Matlab, there is not much I can do about it. I checked in the release notes and they seemed to have made some modifications to the zoom and the contains functions in the 2009b Update 2 release, that you have probably downloaded.

My guess is that either they have introduced a new bug, or you have added something new to your Matlab path that shadows the Matlab functions zoom, contains, or strfind.
Start by removing everything in your Matlab path that is not coming from the Matlab installation folder.

If it still crashes in a reproducible way, could you please post a bug report on the Mathworks website?

  • Make sure it crashes when you execute z = zoom(gcf) from the Matlab command line with the offensive figure opened
  • Right-click on the figure > Snapshot > Open as figure (it will make a copy of the figure without any of the Brainstorm callbacks)
  • Check that z = zoom(gcf) still crashes
  • Save the figure as a .fig file with the Matlab menus
  • Open a bug report on the Mathworks website, and include the .fig file and the explanation that z = zoom(gcf) does not work with this figure.

Thanks
Francois

@MartinC Could you try downloading this Matlab 2019b Update2 and see if it causes any trouble?
(otherwise I'd be able to do this but in two weeks)

1 Like

Hi guys,

I updated my Matlab to 2019b Update 2 and I could not reproduce this issue (on Windows). I agree with François that a likely issue is that there is something in the Matlab path that shadows built-in Matlab functions.

Martin

Hi everyone,

I did as suggested and restored the default Matlab paths. Now it works fine. I must have done something that confused Matlab.

Thanks :slight_smile: