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: Wed, 30 May 2012 19:00:45 +0200

>> octave:1> cell{1:5}=1
>> error: invalid assignment to cs-list outside multiple assignment.
>> error: assignment to cell array failed
>> error: assignment failed, or no method for `<unknown type> = scalar'
>>
>> It used to work in past versions. This code is from an old functioning
>> script from me. What happened?
>
>If it used to work, it was a bug. Use () instead of {} to index cells
>with assignment.

I have this code:

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".

I understand neither the first nor the second fact.

-- 
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]