[Scilab-Dev] SEP #40: Cell Arrays

Bruno JOFRET bruno.jofret at scilab.org
Mon Mar 29 15:11:51 CEST 2010


Serge Steer wrote:
> It seems good. Just a point:
> 
> It should be good that  for cells extraction and insertion (value or
> subcells) the examples explains how vector index will be handled:
> what is c(1:2,:) and c{1:2,:}
>              c(1:2,1)={'xx';'yy'}
>              v=list('u','v');c{1:2,1}=v(:) //should it be valid or an error?
> 

Hi,

The syntax using braces "will be" strictly equivalent to the ".entries" one.
Considering this, the example here do not actually work.

--> c = cell([2,1]);

-->c(1:2,1) =  makecell([2,1], 'xx', 'yy')
  c  =


!"xx"  !
!      !
!"yy"  !

-->v=list('u','v');


-->c(1:2,1).entries = v(:)
                         !--error 41
Incompatible output argument.


Even trying this in Octave gives an error :
octave:1> c(1:2,1)={'xx';'yy'}
c =

{
   [1,1] = xx
   [2,1] = yy
}

octave:2> v={'u','v'}
v =

{
   [1,1] = u
   [1,2] = v
}

octave:3> c{1:2,1}=v(:)
error: invalid assignment to cs-list outside multiple assignment.
error: assignment to cell array failed
error: assignment failed, or no method for `cell = cell'
octave:3> c{1:2,1}=v{:}
error: invalid assignment to cs-list outside multiple assignment.
error: assignment to cell array failed
error: assignment failed, or no method for `cell = sq_string'


So I guess we could raise the same error as before in this particular case.

Regards,

-- 
Bruno JOFRET
Software Architect

The Scilab Consortium
Digiteo Foundation
Domaine de Voluceau
Rocquencourt - B.P. 105
78153 Le Chesnay France
Phone: +33.1.39.63.58.63



More information about the dev mailing list