FROM STRING TO ARRAY

조회 수: 6 (최근 30일)
ahmad abusara
ahmad abusara 2019년 6월 30일
편집: Adam Danz 2019년 7월 2일
how i can to change from string like that :
x = ('ABCDE') ;
to array like:
y = [A,B,C,D,E];
  댓글 수: 1
Jan
Jan 2019년 6월 30일
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

댓글을 달려면 로그인하십시오.

답변 (1개)

Adam Danz
Adam Danz 2019년 6월 30일
편집: Adam Danz 2019년 7월 2일
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{:});

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by