Is there a function to do this?
古いコメントを表示
回答 (3 件)
There is no need to manipulate the format string, it is much simpler to use the '*' option:
>> sprintf('%0*d',4,12)
ans = 0012
Fangjun Jiang
2018 年 1 月 8 日
With this, will you be able to work out the function?
>> sprintf('%04d',12)
ans =
'0012'
カテゴリ
ヘルプ センター および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!