フィルターのクリア

How to add multiple 0s in front of number with numstr?

2 ビュー (過去 30 日間)
Kelsey Ward
Kelsey Ward 2022 年 11 月 24 日
コメント済み: Jan 2022 年 11 月 25 日
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 件のコメント
Kelsey Ward
Kelsey Ward 2022 年 11 月 24 日
yep, thanks, just had an error farther back that was setting it to 100 instead of 1
Jan
Jan 2022 年 11 月 25 日
By the way, num2str calls sprintf internally.You can call this directly also:
sprintf('%04d', i)

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by