help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cell{1:5}=1 not working for me!!!


From: Francesco Potortì
Subject: Re: cell{1:5}=1 not working for me!!!
Date: Thu, 31 May 2012 13:07:06 +0200

>> 1:  s = cell(sn);
>> 2:  for txi = 1:sn
>> 3:    for rxi = 1:sn
>> 4:      s{txi,rxi} = NA(mt,1);
>> 5:      x = t(ti);
>> 6:      y = rx(ti,rxi);
>> 7:      s{txi,rxi}(x) = y;
>> 8:    endfor
>> 9:  endfor
>>
>> I seem never to really understand how cells work.  Or maybe I use them
>> so widely apart in time that I forget...
>>
>> If I change row 4 to index s with () rather than {}, it works.  If I
>> change row 7 the same way, I get "error: () must be followed by . or
>> close the index chain".
>
>The first fact is easy to understand: you can assign to a cell with
>any of the operators () or {}.

Is there an historical reason to this, I suppose, or more simply a
Matlab compatibility reason.  I find this ambiguity confusing.  Is there
a recommended style?

-- 
Francesco Potortì (ricercatore)        Voice:  +39.050.315.3058 (op.2111)
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Fax:    +39.050.315.2040  
(entrance 20, 1st floor, room C71)     Web:    http://fly.isti.cnr.it


reply via email to

[Prev in Thread] Current Thread [Next in Thread]