Borrar filtros
Borrar filtros

How to convert numbers to text

3 visualizaciones (últimos 30 días)
Tomaszzz
Tomaszzz el 5 de Ag. de 2024
Respondida: Stephen23 el 5 de Ag. de 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?

Respuesta aceptada

Stephen23
Stephen23 el 5 de Ag. de 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'

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by