How to convert numbers to text

2 views (last 30 days)
Tomaszzz
Tomaszzz on 5 Aug 2024
Answered: Stephen23 on 5 Aug 2024
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?

Accepted Answer

Stephen23
Stephen23 on 5 Aug 2024
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'

More Answers (0)

Categories

Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!