help-octave
[Top][All Lists]
Advanced

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

Re: Assigning matrices to structures.


From: Jaroslav Hajek
Subject: Re: Assigning matrices to structures.
Date: Tue, 6 Oct 2009 18:02:41 +0200

On Tue, Oct 6, 2009 at 4:47 PM, Rishi Amrit <address@hidden> wrote:
> Hi,
>    The following statement:
> a{1:10} = zeros(1,2)
> used to work until version 3.0.5. It does not work from 3.2 onwards. Any
> suggestions on how to change the code to make it work with the new versions
> of Octave ? I dont want to add for loops.
> Thanks,
> Rishi

This was, in fact, an accidental "misfeature". a{1:10} generates a
cs-list, so it should be enclosed in [] to form a valid set of
lvalues. Either of the following should work as a replacement (and
probably work in 3.0.5 too):
a(1:10) = {zeros(1,2)};
[a{1:10}] = deal (zeros(1,2));

hth

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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