ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
using_hg2.m
Go to the documentation of this file.
1%USING_HG2 Determine if the HG2 graphics engine is used
2%
3% tf = using_hg2(fig)
4%
5%IN:
6% fig - handle to the figure in question.
7%
8%OUT:
9% tf - boolean indicating whether the HG2 graphics engine is being used
10% (true) or not (false).
11
12% 19/06/2015 - Suppress warning in R2015b; cache result for improved performance
13% 06/06/2016 - Fixed issue #156 (bad return value in R2016b)
14
15function tf = using_hg2(fig)
16 persistent tf_cached
17 if isempty(tf_cached)
18 try
19 if nargin < 1, fig = figure('visible','off'); end
20 oldWarn = warning('off','MATLAB:graphicsversion:GraphicsVersionRemoval');
21 try
22 % This generates a [supressed] warning in R2015b:
23 tf = ~graphicsversion(fig, 'handlegraphics');
24 catch
25 tf = ~verLessThan('matlab','8.4'); % =R2014b
26 end
27 warning(oldWarn);
28 catch
29 tf = false;
30 end
31 if nargin < 1, delete(fig); end
32 tf_cached = tf;
33 else
34 tf = tf_cached;
35 end
36end
function using_hg2(in fig)