Assign values to a string in Matlab
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Laura Paola Goyeneche Gomez
el 16 de Oct. de 2019
Respondida: Stephen23
el 16 de Oct. de 2019
For example I have:
X ='abcaaabc';
How can I get it like
Y= [a b c a a a b c];
and
Y1= [0 1 2 0 0 0 1 2]
0 comentarios
Respuestas (2)
Fangjun Jiang
el 16 de Oct. de 2019
Y1=X-97
1 comentario
Fangjun Jiang
el 16 de Oct. de 2019
Editada: Fangjun Jiang
el 16 de Oct. de 2019
You can't have the Y you want. Maybe Y=[X(:)], or Y=transpose(string(X'))
Stephen23
el 16 de Oct. de 2019
>> X = 'abcaaabc';
>> Y = num2cell(X)
Y =
'a' 'b' 'c' 'a' 'a' 'a' 'b' 'c'
>> Y1 = X-97
Y1 =
0 1 2 0 0 0 1 2
0 comentarios
Ver también
Categorías
Más información sobre Data Types en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!