% routine to add a leading zero if needed

function [out]=lead0(in,digit);

if length(in)<digit;

   lin=digit-length(in);

   out=in;

   for k=1:lin;

      out=['0' out];

   end;

else;
   out=in;
end;   

   

