matRad progress bar call matRad_progress(currentIndex, totalNumberOfEvaluations) input currentIndex: current iteration index totalNumberOfEvaluations: maximum iteration index output graphical display of progess. make sure there is no other output written during the loop to prevent confusion References - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright 2015 the matRad development team. This file is part of the matRad project. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part of the matRad project, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE file. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function matRad_progress(currentIndex, totalNumberOfEvaluations) 0002 % matRad progress bar 0003 % 0004 % call 0005 % matRad_progress(currentIndex, totalNumberOfEvaluations) 0006 % 0007 % input 0008 % currentIndex: current iteration index 0009 % totalNumberOfEvaluations: maximum iteration index 0010 % 0011 % output 0012 % graphical display of progess. make sure there is no other output 0013 % written during the loop to prevent confusion 0014 % 0015 % References 0016 % - 0017 % 0018 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0019 % 0020 % Copyright 2015 the matRad development team. 0021 % 0022 % This file is part of the matRad project. It is subject to the license 0023 % terms in the LICENSE file found in the top-level directory of this 0024 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part 0025 % of the matRad project, including this file, may be copied, modified, 0026 % propagated, or distributed except according to the terms contained in the 0027 % LICENSE file. 0028 % 0029 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0030 0031 % If it's not the first step, erase the stuff printed before 0032 if (currentIndex == 1 || nargin > 2) 0033 fprintf('Progress: '); 0034 end 0035 0036 if (currentIndex > 1 && nargin < 3) 0037 Length = numel(sprintf('%3.2f %%',(currentIndex-1)/totalNumberOfEvaluations*100)); 0038 fprintf(repmat('\b',1,Length)); 0039 end 0040 0041 % Print the progress tool 0042 fprintf('%3.2f %%',currentIndex/totalNumberOfEvaluations*100); 0043 0044 % After the last iteration print a newline command 0045 if (currentIndex == totalNumberOfEvaluations) 0046 fprintf('\n'); 0047 end 0048 0049 end