Assign values to a string in Matlab
Ältere Kommentare anzeigen
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]
Antworten (2)
Fangjun Jiang
am 16 Okt. 2019
Y1=X-97
1 Kommentar
Fangjun Jiang
am 16 Okt. 2019
Bearbeitet: Fangjun Jiang
am 16 Okt. 2019
You can't have the Y you want. Maybe Y=[X(:)], or Y=transpose(string(X'))
Stephen23
am 16 Okt. 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
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!