MATLAB: How to add leading zeros to a number in Matlab

leading zeros

Hi everyone,
I am writing a piece of programme in VEE Pro which can accept MATLAB commands. This programme creates numbers from 1 to 32. Then they are converted to their binary equivalent. what I want is all of those equivalents appear in 6 digits, for example if 32 is 100000 I want 1 as 000001 not 1. Is there any command in MATLAB which does this job? then I can call it into my own progr. I appreciate your help:)
S.

Best Answer

dec2bin(1,6)
Related Question