Silencing Matlab warning messages about javacomponent

Edit: Actually, this doesn't work with Bst figures for some reason. :frowning_face: Is there any way we can get rid of these warnings?

I was hoping to use this command to stop all those annoying warning messages when using Brainstorm figures:

warning('off','MATLAB:ui:javacomponent:FunctionToBeRemoved')

This is already done everywhere javacomponent is still used (eg. brainstorm3/toolbox/gui/figure_mri.m at master · brainstorm-tools/brainstorm3 · GitHub), except for the connectivity graphs, since its future was not clearly established at the time I coded bst_javacomponent.

Now we know we should have a replacement for figure_connect.m in a few months, we can simply hide the javacomponent warning in the same way: Bugfix: Hide javacomponent warning for figure_connect · brainstorm-tools/brainstorm3@8caf970 · GitHub

Actually, this doesn't work with Bst figures for some reason

What do you mean?
You still get these messages for:

  • which figures?
  • which version of Matlab?
  • which OS?

Hi François.

In figure_timeseries>PlotRawTimeBar (line 4388)
In figure_timeseries>CreateScaleButtons (line 3881)

Matlab 2019b, Ubuntu 18.

Also:

Warning: The JavaFrame figure property will be removed in a future release.
For more information, see Recommendations for Java and ActiveX Users
on mathworks.com. 
> In bst_get (line 3858)
  In gui_popup (line 46)
  In figure_timeseries>DisplayFigurePopup (line 2406)
  In figure_timeseries>FigureMouseUpCallback (line 636) 

Thanks!

Matlab 2019b, Ubuntu 18.

I removed these calls starting from 2020a... Wrong assumption, I changed it to 2019b (bst_get('MatlabVersion') = 907).

Warning: The JavaFrame figure property will be removed in a future release.
For more information, see Recommendations for Java and ActiveX Users
on mathworks.com. 
> In bst_get (line 3858)

The line numbers don't correspond to the current version of Brainstorm.

In bst_get.m > Lines 3859-3861:

    warning('off', 'MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
    if = get(hFig, 'javaframe');
    warning('on', 'MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame'); 

Make sure your code is up-to-date before testing again.

If the warning('off'...) statements do not turn the messages off, there is something else that doesn't work. Maybe the warnings were different 2019b. Execute [a,b]=lastwarn to get the warning ID to turn off.

If after fixing the warning ID, the warnings are still generated, then there is problem with MATLAB itself: please post a bug report on the Mathworks website.

Works thanks!