How to pad zeros in the front of the number using 'num2str'
94 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 25 de Ag. de 2016
Respondida: MathWorks Support Team
el 27 de Sept. de 2016
How to pad zeros in the front of the number using 'num2str' ?
Respuesta aceptada
MathWorks Support Team
el 25 de Ag. de 2016
For example, you have 47 and you want the output to be 047
Please use the following command:
>> num = 47;
>> num2str(num,'%03.f');
The '%03.f' format specifier indicates that there would totally 3 digits before the decimal point prepended with 0 depending on the digits in the number.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!