How to pad zeros in the front of the number using 'num2str'
95 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2016-8-25
回答: MathWorks Support Team
2016-9-27
How to pad zeros in the front of the number using 'num2str' ?
采纳的回答
MathWorks Support Team
2016-8-25
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!