forked from cultpenguin/mGstat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprogress_txt.m
56 lines (47 loc) · 834 Bytes
/
progress_txt.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
% progress_txt : console based progress bar
%
% Ex1 :
% for i=1:10000;
% progress_txt(i,10000,'Ciao');
% end
%
% Ex1 :
%
% for i=1:10;
% for j=1:10;
% for k=1:10;
% progress_txt([i j k],[10 100 1000],'i','j','k');
% end
% end
% end
%
% TMH/2005, [email protected]
%
function progress_txt(i,max,varargin);
if nargin==0
help progress_txt
return;
end
ncols=length(i);
%
nchar=45;
%
pc=i./max;
% clear command window
clc;
for m=1:ncols
try
txt=varargin{m};
catch
txt='';
end
char_prog='';
for j=1:nchar
if j<=(pc(m)*nchar);
char_prog=[char_prog,'#'];
else
char_prog=[char_prog,'_'];
end
end
disp(sprintf('%10s %s %3.1f%% %d/%d',txt,char_prog,100*pc(m),i(m),max(m)))
end