How do i break a string down into cell arrays containing a string?

I have a string separated by commas as below: 'Apples, Bananas, Dogs, Cats'
How do i break it down to become a 4x1 cell array containing {Apples; Bananas; Dogs; Cats}
Thanks in advance!

 採用された回答

Jos (10584)
Jos (10584) 2017 年 12 月 14 日

1 投票

S = 'Apples, Bananas, Dogs, Cats'
C = strsplit(S, ',')

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCell Arrays についてさらに検索

質問済み:

2017 年 12 月 14 日

回答済み:

2017 年 12 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by