How to add multiple 0s in front of number with numstr?
1 次查看(过去 30 天)
显示 更早的评论
I have been using " num2str(i,'%04d') " which is giving me strings of "0100," "0200," etc. I can't seem to figure out a version of the code that will give me "0001" "0002".
3 个评论
Jan
2022-11-25
By the way, num2str calls sprintf internally.You can call this directly also:
sprintf('%04d', i)
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!