Home > vbmeg > functions > common > utility > vb_disp_waitbar.m

vb_disp_waitbar

PURPOSE ^

Display waitbar.

SYNOPSIS ^

function h = vb_disp_waitbar(parcent, caption, verbose_level_min)

DESCRIPTION ^

 Display waitbar.

 This function shows a message on the MATLAB console. The message is
 automatically suppressed according to vbmeg_inst.verbose_level. 

 [syntax]
 vb_disp_waitbar(parcent, caption, verbose_level_min)

 [input]
 parcent          : <<string>> parcentage of progress.(0.1-1)
 verbose_level_min: <optional> <<int or string>> Verbose level of this
                    message. 
 --- verbose level string (verbose_level_min)
   'NONE' (=0)      Suppressing all messages 
   'EMERGENCY' (=1)
   'WARNING' (=2)
   'NOTICE' (=3)    VBMEG default value
   'INFO' (=5)
   'DEBUG' (=10)    Displaying all messages
 ---

 [output]
 h                : waitbar handle.
 
 [example]
 >> vb_disp_waitbar(parcent, 'caption'); % same with below
 >> vb_disp_waitbar(parcent, 'caption','NOTICE'); % default=NOTICE
 >> vb_disp_waitbar(parcent, 'caption', 3); % 3 is NOTICE

 exmaple of message suppression
 >> vb_set_verbose('WARNING'); % making verbose level low
 >> vb_disp_waitbar(parcent, 'caption'); % same with the 1st line but none is shown

 [history]
 2020-02-12 rhayashi

 [see also]
    vb_set_verbose, vb_get_verbose, vb_disp_nonl

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function h = vb_disp_waitbar(parcent, caption, verbose_level_min)
0002 % Display waitbar.
0003 %
0004 % This function shows a message on the MATLAB console. The message is
0005 % automatically suppressed according to vbmeg_inst.verbose_level.
0006 %
0007 % [syntax]
0008 % vb_disp_waitbar(parcent, caption, verbose_level_min)
0009 %
0010 % [input]
0011 % parcent          : <<string>> parcentage of progress.(0.1-1)
0012 % verbose_level_min: <optional> <<int or string>> Verbose level of this
0013 %                    message.
0014 % --- verbose level string (verbose_level_min)
0015 %   'NONE' (=0)      Suppressing all messages
0016 %   'EMERGENCY' (=1)
0017 %   'WARNING' (=2)
0018 %   'NOTICE' (=3)    VBMEG default value
0019 %   'INFO' (=5)
0020 %   'DEBUG' (=10)    Displaying all messages
0021 % ---
0022 %
0023 % [output]
0024 % h                : waitbar handle.
0025 %
0026 % [example]
0027 % >> vb_disp_waitbar(parcent, 'caption'); % same with below
0028 % >> vb_disp_waitbar(parcent, 'caption','NOTICE'); % default=NOTICE
0029 % >> vb_disp_waitbar(parcent, 'caption', 3); % 3 is NOTICE
0030 %
0031 % exmaple of message suppression
0032 % >> vb_set_verbose('WARNING'); % making verbose level low
0033 % >> vb_disp_waitbar(parcent, 'caption'); % same with the 1st line but none is shown
0034 %
0035 % [history]
0036 % 2020-02-12 rhayashi
0037 %
0038 % [see also]
0039 %    vb_set_verbose, vb_get_verbose, vb_disp_nonl
0040 %
0041 % Copyright (C) 2011, ATR All Rights Reserved.
0042 % License : New BSD License(see VBMEG_LICENSE.txt)
0043 
0044 global vbmeg_inst;
0045 const = vb_define_verbose;
0046 h = [];
0047 
0048 if nargin<3 || isempty(verbose_level_min), 
0049   verbose_level_min = const.VERBOSE_LEVEL_NOTICE;
0050 end
0051 
0052 if ischar(verbose_level_min)
0053   switch verbose_level_min
0054    case 'NONE'
0055     verbose_level_min = 0;
0056    case 'EMERGENCY'
0057     verbose_level_min = 1;
0058    case 'WARNING'
0059     verbose_level_min = 2;
0060    case 'NOTICE'
0061     verbose_level_min = 3;
0062    case 'INFO'
0063     verbose_level_min = 5;
0064    case 'DEBUG'
0065     verbose_level_min = 10;
0066    otherwise
0067     fprintf('Invalid verbose string: %s\n',verbose_level_min);
0068   end
0069 end
0070 
0071 if isempty(vbmeg_inst) || ~isfield(vbmeg_inst,'verbose_level')
0072   verbose_level = const.VERBOSE_LEVEL_NOTICE;
0073 else
0074   verbose_level = vbmeg_inst.verbose_level;
0075 end
0076 
0077 if verbose_level>=verbose_level_min
0078   h = waitbar(parcent, caption);
0079 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005