How to get a string array without any space when using NUM2STR function ???

9 ビュー (過去 30 日間)
LJ Zhou
LJ Zhou 2019 年 3 月 18 日
コメント済み: LJ Zhou 2019 年 3 月 18 日
For example, I have a number array (including one-digits and two digits):
A=[0:31]'
A =
0
1
2
3
4
5
6
7
8
9
10
11
12
...
and I want to convert it to a string/char array. I tried to use:
S = num2str(A)
S =
32×2 char array
' 0'
' 1'
' 2'
' 3'
' 4'
' 5'
' 6'
' 7'
' 8'
' 9'
'10'
'11'
'12'
...
However, I want to get a string array with dimension 31×1, and without any space in front of those one-digits, what should I do????

採用された回答

madhan ravi
madhan ravi 2019 年 3 月 18 日
編集済み: madhan ravi 2019 年 3 月 18 日
S = ""+(0:31).'

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by