digit convertion

how to convert amount of 100 into 000100 through code?

probably you can convert it into a string and concatenate

print ‘000’+ num2str(100,1,1,1,1);

Thanks Kranthi…:slight_smile:

Thanks Kranthi,

but what if the number will keep updating so it will generated together

example :-

100 = 000100

1000 = 001000

10000 = 010000

how to make it generate like this without having to put print ‘000’ at front ?

This is the easiest way:

num2str0(100, 6)
num2str0(1000, 6)
num2str0(10000, 6)

Thank you Martin

found the solution with your idea

heres what i did :-

amount = strReplace(num2str0(realno,12,2,0,0),".","");

result shown = 00000010000

thanks again