フィルターのクリア

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
  1 件のコメント
simon xi
simon xi 2023 年 7 月 8 日
b=string(a)

サインインしてコメントする。

採用された回答

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 Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by