필터 지우기
필터 지우기

cell array to string array

조회 수: 4 (최근 30일)
Ido Gross
Ido Gross 2020년 4월 2일
댓글: simon xi 2023년 7월 8일
Hi
I have a cell array consisting of strings. I would like to convert it to an array with one word in each cell.
for example, the cell array: "Hello B
Hi A
Where is D?
and I need: Hello
B
Hi etc.
TIA

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 2일
편집: Ameer Hamza 2020년 4월 2일
Something like this
A = {'Hello B Hi A Where is D?'};
B = strsplit(A{:}, ' ')';
Result:
B =
7×1 cell array
{'Hello'}
{'B' }
{'Hi' }
{'A' }
{'Where'}
{'is' }
{'D?' }
  댓글 수: 6
Ido Gross
Ido Gross 2020년 4월 2일
Amazing! thank you so much!
Ameer Hamza
Ameer Hamza 2020년 4월 2일
Glad to be of help.

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

추가 답변 (0개)

카테고리

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