You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: progress_txt.m
    path of file: ./repos/segymat
    
    the code of the file until where you have to start completion: % progress_txt : console based progress bar
%
% Ex1 : 
%   for i=1:10000;
%     progress_txt(i,10000,'Ciao');
%   end
%
% Ex1 :
%
%   for i=1:10;
% 
    
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