How to convert numbers to text

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by