String split from the line .

1 次查看(过去 30 天)
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
As an example,
B=split( ',A,B,C,D' , ',');
B=B(~cellfun('isempty',B))
B = 4×1 cell array
{'A'} {'B'} {'C'} {'D'}

更多回答(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