[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cell array issue
From: |
Bård Skaflestad |
Subject: |
Re: cell array issue |
Date: |
Thu, 4 Nov 2010 17:56:51 +0100 |
On Thu, 2010-11-04 at 17:33 +0100, Schirmacher, Rolf wrote:
> Hello,
>
> running 3.2.4 on windows, I have the following issue with cell arrays:
>
> octave.exe> string = "a b c";
> octave.exe> demo2{1} = string
> demo2 =
>
> {
> [1,1] = a b c
> }
>
> octave.exe> demo2{2} = string
> demo2 =
>
> {
> [1,1] = a b c
> [1,2] = a b c
> }
>
> octave.exe> demo3{1:2} = string
> error: invalid assignment to cs-list outside multiple assignment.
> error: assignment to cell array failed
> error: assignment failed, or no method for `<unknown type> = string'
>
>
> I would like demo3 to be the same as demo2 in this case (i.e. allow for
> indexing for cell arrays).
>
> This worked as described in 3.0.3 on windows...
Use either of these
demo3(1:2) = { string }
[demo3{1:2}] = deal(string)
I personally prefer the first syntax, though it might not be applicable
at all times. I'll defer to other to answer on the validity of
'demo3{1:2}=string' producing expected results in 3.0.3.
Sincerely,
--
Bård Skaflestad <address@hidden>
SINTEF ICT, Applied mathematics
- cell array issue, Schirmacher, Rolf, 2010/11/04
- Re: cell array issue,
Bård Skaflestad <=