From: roya olyazadeh on 7 May 2010 03:17 I have this : SX = [] 'y1' 'x2' 'y2' 'x3' 'y3' [] [] 'x5' 'y5' How can I remove empty cell [] which results : SX = 'y1' 'x2' 'y2' 'x3' 'y3' 'x5' 'y5' then I can call for example : SX{3}='x2'
From: Walter Roberson on 7 May 2010 03:34 roya olyazadeh wrote: > I have this : SX = > [] 'y1' 'x2' 'y2' 'x3' 'y3' [] [] 'x5' > 'y5' > How can I remove empty cell [] which results : > > > SX = > 'y1' 'x2' 'y2' 'x3' 'y3' 'x5' 'y5' > then I can call for example : SX{3}='x2' SX = SX(~isempty(SX));
From: roya olyazadeh on 7 May 2010 03:49 Walter Roberson <roberson(a)hushmail.com> wrote in message <QnPEn.145$rE4.41(a)newsfe15.iad>... > roya olyazadeh wrote: > > I have this : SX = > > [] 'y1' 'x2' 'y2' 'x3' 'y3' [] [] 'x5' > > 'y5' > > How can I remove empty cell [] which results : > > > > > > SX = > > 'y1' 'x2' 'y2' 'x3' 'y3' 'x5' 'y5' > > then I can call for example : SX{3}='x2' > > SX = SX(~isempty(SX)); It did not work . See result : SX = {[]}
From: Bruno Luong on 7 May 2010 03:56 >> SX={[] 'a' 'b' 'c' []} SX = [] 'a' 'b' 'c' [] >> SX(~isempty(SX)) % Walter code which I don't understand ans = {[]} >> SX(cellfun('isempty',SX)) = [] SX = 'a' 'b' 'c' % Bruno
From: Walter Roberson on 7 May 2010 04:02
roya olyazadeh wrote: > Walter Roberson <roberson(a)hushmail.com> wrote in message > <QnPEn.145$rE4.41(a)newsfe15.iad>... >> roya olyazadeh wrote: >> > I have this : SX = >> > [] 'y1' 'x2' 'y2' 'x3' 'y3' [] [] >> 'x5' > 'y5' >> > How can I remove empty cell [] which results : >> > > > SX = >> > 'y1' 'x2' 'y2' 'x3' 'y3' 'x5' 'y5' >> > then I can call for example : SX{3}='x2' >> >> SX = SX(~isempty(SX)); > > It did not work . See result : > > SX = > {[]} Sorry, SX = SX(~cellfun(@isempty,SX)); |