Blame view

old/rtsInt2Str.m 396 Bytes
8be1ab93   David Mayerich   initial commit of...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  function result = rtsInt2Str(num, digits)
  
  
  %get the number of digits in the current number
  temp = num;
  current_digits = 0;
  while temp >= 1
      temp = temp/10;
      current_digits = current_digits+1;
  end
  
  if current_digits > digits
      result = int2str(num);
  else
      result = [];
      for i = 1:digits - current_digits
          result = [result '0'];
      end
      result = [result int2str(num)];
  end