% Authors:
%
% Shuang Wang, Lijuan Cui and Samuel Cheng
%
% Copyright:
%
% Copyright ? 2007-2011 Shuang Wang
%
% Questions:
%
% For any questions, please contact me by shuangwang AT ou dot edu
%
% reference
% L. Cui, S. Wang, S. Cheng, M. Yeary, "Adaptive Binary Slepian-Wolf Decoding using Particle Based Belief Propagation", Communications, IEEE Transactions on, to appear.
% S. Wang, L. Cui, S. Cheng, Y. Zhai, M. Yeary, Q. Wu, "Noise Adaptive LDPC Decoding Using Particle Filtering," Communications, IEEE Transactions on, Vol 59. pp. 913 - 916, April 2011.
%
function h = progressBar(h, currentPos, maxPos)
% h is the handle.
% currentPos start from 1 to maxPos;
if(isempty(h))
h.maxPos = maxPos;
h.startTime = tic;
h.totalCount = 10;
h.step = fix((h.maxPos - 1)/h.totalCount) + 1;
h.count = 0;
else
if(currentPos >= h.maxPos)
for i = (h.count+1):h.totalCount
fprintf('.');
h.count = h.count + 1;
end
if(h.count == h.totalCount)
fprintf('(%s s)]', stringPad(sprintf('%3.3f', toc(h.startTime)), 7));
h.count = h.count + 1;
end
elseif(mod((currentPos-1), h.step) == 0)
if(h.count == 0)
fprintf('[.');
else
fprintf('.');
end
h.count = h.count + 1;
end
end
end
function str = stringPad(str, len)
dist = len - numel(str);
if(dist > 0)
spacing = ' ';
str = [spacing(1:dist), str];
end
end