I want format integer value by adding leading zeros and display it as string. For example, I have 3 and I want to display it as 003. I want to do i
3
003
Note that you can also use string formatting in num2str command as well:
num2str( 3, '%03d' );