Enginius/Matlab
Simple Loop Indicator
해리s
2013. 11. 24. 00:13
prevPercentage = -1;
for j = 1:nrSeq
currPercentage = floor(j/nrSeq*10);
if currPercentage > prevPercentage
prevPercentage = currPercentage;
fprintf('[%d/%d] %d %% Finished \n' ...
, j, nrSeq, 10*prevPercentage);
end
for j = 1:nrSeq
currPercentage = floor(j/nrSeq*10);
if currPercentage > prevPercentage
prevPercentage = currPercentage;
fprintf('[%d/%d] %d %% Finished \n' ...
, j, nrSeq, 10*prevPercentage);
end
..........
end
Result
[1/1788728] 0 % Finished
[178873/1788728] 10 % Finished
[357746/1788728] 20 % Finished
[536619/1788728] 30 % Finished
[715492/1788728] 40 % Finished
[894364/1788728] 50 % Finished
[1073237/1788728] 60 % Finished
[1252110/1788728] 70 % Finished
[1430983/1788728] 80 % Finished
[1609856/1788728] 90 % Finished
[1788728/1788728] 100 % Finished
[178873/1788728] 10 % Finished
[357746/1788728] 20 % Finished
[536619/1788728] 30 % Finished
[715492/1788728] 40 % Finished
[894364/1788728] 50 % Finished
[1073237/1788728] 60 % Finished
[1252110/1788728] 70 % Finished
[1430983/1788728] 80 % Finished
[1609856/1788728] 90 % Finished
[1788728/1788728] 100 % Finished