How to convert numbers to text

2 ビュー (過去 30 日間)
Tomaszzz
Tomaszzz 2024 年 8 月 5 日
回答済み: Stephen23 2024 年 8 月 5 日
Hi all,
I have a 15x 1 double where:
rows 1:5 = 0, and I want to change 0 to 'x'
rows 6:10 = 1, and I want to change 1 to 'y'
rows 11:15 = 2, and I want to change 2 to 'z'
Can you help please?

採用された回答

Stephen23
Stephen23 2024 年 8 月 5 日
v = fix((0:14)./5).'
v = 15x1
0 0 0 0 0 1 1 1 1 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
w = char(v+'x')
w = 15x1 char array
'x' 'x' 'x' 'x' 'x' 'y' 'y' 'y' 'y' 'y' 'z' 'z' 'z' 'z' 'z'

その他の回答 (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