How to add zero infront of number

2 ビュー (過去 30 日間)
Muhammad Haziq
Muhammad Haziq 2019 年 3 月 1 日
回答済み: Honglei Chen 2019 年 3 月 1 日
Hi,
I have to add 0 before a number let say num = 2. I want to show as num=02

採用された回答

Honglei Chen
Honglei Chen 2019 年 3 月 1 日
I don't think you can pad zero for a numeric number but you can do it when printing. For example
fprintf('num = %02d\n',2)
Is this what you want? HTH

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by