How to pad zeros in the front of the number using 'num2str'

94 visualizaciones (últimos 30 días)
How to pad zeros in the front of the number using 'num2str' ?

Respuesta aceptada

MathWorks Support Team
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.
 

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Productos


Versión

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by