From: riya on 23 Jul 2010 04:38 i have a <1*39cell>,K containg TL5{1} ans = 'A,B,y,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S1,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n' I want to have each comma separated symbol in a cell array with each symbol in a separate cell can u please tell me the way ;;;; >thank you
From: Oleg Komarov on 23 Jul 2010 05:22 "riya " <sharma.riya921(a)gmail.com> wrote in message <i2bkdd$ss5$1(a)fred.mathworks.com>... > i have a <1*39cell>,K > containg > TL5{1} > ans = > 'A,B,y,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S1,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n' > I want to have each comma separated symbol in a cell array with each symbol in a separate cell > can u please tell me the way ;;;; > >thank you One of the solutions: IDX = [0 find(TL5{1}==',') numel(TL5{1})+1]; Out = arrayfun(@(x,y) TL5{1}(x+1:y-1) ,IDX(1:end-1),IDX(2:end),'un',0); Oleg
From: Oleg Komarov on 23 Jul 2010 05:29 > One of the solutions: > > IDX = [0 find(TL5{1}==',') numel(TL5{1})+1]; > Out = arrayfun(@(x,y) TL5{1}(x+1:y-1) ,IDX(1:end-1),IDX(2:end),'un',0); > > Oleg Another one: Out = textscan(TL5{1},'%s','delimiter',','); Out = Out{1}; Oleg
From: Oleg Komarov on 23 Jul 2010 05:35 "Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <i2bnd1$1r3$1(a)fred.mathworks.com>... > > One of the solutions: > > > > IDX = [0 find(TL5{1}==',') numel(TL5{1})+1]; > > Out = arrayfun(@(x,y) TL5{1}(x+1:y-1) ,IDX(1:end-1),IDX(2:end),'un',0); > > > > Oleg > > Another one: > Out = textscan(TL5{1},'%s','delimiter',','); > Out = Out{1}; > > Oleg Last one: Out = regexp(TL5{1},'\w*','match'); Oleg
From: Jan Simon on 23 Jul 2010 05:47 Hallo Riya, > TL5{1} = 'A,B,y,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S1,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n' > I want to have each comma separated symbol in a cell array with each symbol in a separate cell And another one: C = dataread('string', TL5{1}, '%s', 'delimiter', ','); Jan
|
Pages: 1 Prev: system identification toolbox Next: constrained optimization |