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: Wed, 30 May 2012 11:52:34 -0400

On 30 May 2012 11:36, oxy <address@hidden> wrote:
> And why a cell cannot be initialized as global?
>
> octave:12> global p
> octave:13> p(1:5)={3}
> error: operator =: no conversion for assignment of `cell' to indexed `matrix'
> error: assignment failed, or no method for `matrix = cell'

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

HTH,
- Jordi G. H.


reply via email to

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