Very simple logical question
1 回表示 (過去 30 日間)
古いコメントを表示
Hello all
I want to generate the set of numbers such that each number is having the same number of digits.
Something like this: 0001,0002,0003,.....0010,0011,0012,.....0100,0101,0102.....,0998,0999,1000
can anyone please help me with this?
Regards
3 件のコメント
Patrik Ek
2014 年 8 月 7 日
Ok I do not think char is the only possiblility, that is why I asked. I would recommend this solution by Andrei Bobrov.
採用された回答
Andrei Bobrov
2014 年 8 月 7 日
編集済み: Andrei Bobrov
2014 年 8 月 7 日
arrayfun(@(x)sprintf('%04d',x),1:1000,'un',0);
or
reshape(sprintf('%04d',1:1000),4,[])'
0 件のコメント
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!