From: Bruno Luong on

> Sorry,
>
> SX = SX(~cellfun(@isempty,SX));

Better and faster: use Matlab pre-implementation of ISEMPTY rather than user function handle @ISEMPTY.

SX = SX(~cellfun('isempty',SX));

Bruno
From: us on
"roya olyazadeh" <roya2543(a)gmail.com> wrote in message <hs0epg$90a$1(a)fred.mathworks.com>...
> 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'

one of the solutions

c={[],'a',[],'b',{},{[]}};
c=c(~cellfun('isempty',c))
% c = 'a' 'b' {1x1 cell}

us
From: roya olyazadeh on
"us " <us(a)neurol.unizh.ch> wrote in message <hs0ia0$she$1(a)fred.mathworks.com>...
> "roya olyazadeh" <roya2543(a)gmail.com> wrote in message <hs0epg$90a$1(a)fred.mathworks.com>...
> > 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'
>
> one of the solutions
>
> c={[],'a',[],'b',{},{[]}};
> c=c(~cellfun('isempty',c))
> % c = 'a' 'b' {1x1 cell}
>
> us


Tnx US , this one works c=c(~cellfun('isempty',c))