rtsInt2Str.m
415 Bytes
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