Hello!
I have strings stored in "myline" variable.
myline = ,A,B,C,D,E,F,G,H,I,J,K
I want to split the string at(,) and also wants to remove the empty space(" ",A) which is available before A.
Further I want to store these in variable "B".
B={'A';'B';'C';'D';'E';'F';'G';'H';'I''J';'K'}

 採用された回答

Matt J
Matt J 2021 年 4 月 5 日
編集済み: Matt J 2021 年 4 月 5 日

0 投票

As an example,
B=split( ',A,B,C,D' , ',');
B=B(~cellfun('isempty',B))
B = 4×1 cell array
{'A'} {'B'} {'C'} {'D'}

3 件のコメント

Karanvir singh Sohal
Karanvir singh Sohal 2021 年 4 月 5 日
There is empty space string before A ( ,A,B,C...)
How can I remove it.
Matt J
Matt J 2021 年 4 月 5 日
Add
B=B(~cellfun('isempty',B))
Karanvir singh Sohal
Karanvir singh Sohal 2021 年 4 月 5 日
Thanks @Matt J :)

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Update figure-Based Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by