Skip to content
Snippets Groups Projects
Select Git revision
  • c932738d1e3778ae61c55d8eb825f7dea2d85a7c
  • master default
  • sparse-tree
  • sparse-sep
  • isfile
  • nlf-fixes
  • newton-quadratic-equation-solver
  • nlf-fixes-r
  • nls-fixes
  • sep-fixes
  • sep
  • use-dprior
  • ep-sparse
  • rebase-1
  • parfor
  • reset-seed-in-unit-tests
  • remove-persistent-variables
  • nonlinear-filter-fixes
  • pac-mce-with-composite-target
  • 6.x
  • dprior
  • 5.5
  • 5.4
  • 5.3
  • 5.2
  • 5.1
  • 5.0
  • 5.0-rc1
  • 4.7-beta3
  • 4.7-beta2
  • 4.7-beta1
  • 4.6.4
  • 4.6.3
  • 4.6.2
  • 4.6.1
  • 4.6.0
  • 4.6.0-rc2
  • 4.6.0-rc1
  • 4.6-beta1
  • 4.5.7
  • 4.5.6
41 results

dyn_waitbar.m

Blame
  • Forked from Dynare / dynare
    284 commits behind the upstream repository.
    dyn_waitbar.m 1.98 KiB
    function h = dyn_waitbar(prctdone, varargin)
    % h = dyn_waitbar(prctdone, varargin)
    % adaptive waitbar, producing console mode waitbars with
    % octave and when console_mode=1
    
    %
    % Copyright © 2011-2017 Dynare Team
    %
    % This file is part of Dynare.
    %
    % Dynare is free software: you can redistribute it and/or modify
    % it under the terms of the GNU General Public License as published by
    % the Free Software Foundation, either version 3 of the License, or
    % (at your option) any later version.
    %
    % Dynare is distributed in the hope that it will be useful,
    % but WITHOUT ANY WARRANTY; without even the implied warranty of
    % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % GNU General Public License for more details.
    %
    % You should have received a copy of the GNU General Public License
    % along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
    global options_
    persistent running_text newString
    persistent whoiam Parallel
    
    if iscell(prctdone)
        whoiam = prctdone{2};
        Parallel = prctdone{3};
        prctdone=prctdone{1};
    end
    
    if prctdone==0
        init=1;
        if isempty(whoiam)
            whoiam=0;
        end
    else
        init=0;
    end
    if nargout
        h=[];
    end
    
    if ~whoiam
        if options_.console_mode
            if init
                diary off;
                running_text = varargin{1};
                newString='';
                return
            elseif nargin>2
                running_text =  varargin{2};
            end
            s0=repmat('\b',1,length(newString));
            newString=sprintf([running_text,' %3.f%% done'], prctdone*100);
            fprintf([s0,'%s'],newString);
        else
            if nargout
                h = waitbar(prctdone,varargin{:});
            else
                waitbar(prctdone,varargin{:});
            end
        end
    else
        if init
            running_text = varargin{1};
        elseif nargin>2
            running_text = varargin{2};
        end
        if Parallel.Local
            waitbarTitle='Local ';
        else
            waitbarTitle=[Parallel.ComputerName];
        end
        fMessageStatus(prctdone,whoiam,running_text, waitbarTitle, Parallel);
    end