FROM STRING TO ARRAY

6 Ansichten (letzte 30 Tage)
ahmad abusara
ahmad abusara am 30 Jun. 2019
Bearbeitet: Adam Danz am 2 Jul. 2019
how i can to change from string like that :
x = ('ABCDE') ;
to array like:
y = [A,B,C,D,E];
  1 Kommentar
Jan
Jan am 30 Jun. 2019
Please explain, what "[A,B,C,D,E];" means. What is the contents of the variables A, B, C, D, E?
If you really want to access variables dynamically by their names: Don't do thia. TUTORIAL: Why and how to avoid EVAL

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Adam Danz
Adam Danz am 30 Jun. 2019
Bearbeitet: Adam Danz am 2 Jul. 2019
From char to cell array of characters
x = 'ABCDE';
y = num2cell(x);
y =
1×5 cell array
{'A'} {'B'} {'C'} {'D'} {'E'}
...to string array of single characters
ys =string(y)
ys =
1×5 string array
"A" "B" "C" "D" "E"
From String to cell array of characters
x = "ABCDE";
y = num2cell(x{:});

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by