From: roya olyazadeh on
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
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
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
>> 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
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));