function ctdisp(n)
% This function displays the counter on 1 line of command window if n is between 1 and 10,000
if n==1, disp(int2str(n)),
elseif n>1 && n<=10
	fprintf(['\b','\b']); disp(int2str(n))
elseif n>10 && n<=100
	fprintf(['\b','\b', '\b']); disp(int2str(n))
elseif n>100 && n<=1000
	fprintf(['\b','\b', '\b', '\b']); disp(int2str(n))
elseif n>1000 && n<=10000
	fprintf(['\b','\b', '\b', '\b', '\b']); disp(int2str(n))
elseif  n>10000 && n<=100000
	fprintf(['\b','\b', '\b', '\b', '\b', '\b']); disp(int2str(n))
elseif n>100000 && n<=1000000
	fprintf(['\b','\b', '\b', '\b', '\b', '\b', '\b']); disp(int2str(n))
end

end