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: Jordi Gutiérrez Hermoso
Subject: Re: cell{1:5}=1 not working for me!!!
Date: Thu, 31 May 2012 10:39:22 -0400

On 31 May 2012 09:28, oxy <address@hidden> wrote:
> ... trying to generate a global cell. First try: cell(1:5)={3}
>
>>You haven't initialised p to be anything yet. When you do `p(1:5)', by
>>default `p(1:5)' is a matrix, not a cell array. Matrices can't contain
>>cells such as {3}
>>Instead do `p = {}' before you do `p(1:5) = 3'.
>
>
> This is a very important point to be a hidden trick.
> I suggest writing it on the documentation since using
> global cells must be common place.

Being global has got nothing to do with it. I'm not sure if this is a
hidden trick. Since Octave is a matrix-oriented language, everything
is a matrix by default. Where did you look for this in the
documentation and didn't find it?

- Jordi G. H.


reply via email to

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