[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using setfield with an object (getting an error)
From: |
Ben Abbott |
Subject: |
Re: using setfield with an object (getting an error) |
Date: |
Sun, 02 Oct 2011 12:30:07 -0400 |
On Oct 2, 2011, at 11:26 AM, Carnë Draug wrote:
> 2011/10/2 Carnë Draug <address@hidden>:
>> Hi,
>>
>> I get the following error when using setfield to set the value of one
>> of the fields if the structure is an object (I actually get the first
>> 2 lines repeated many times before getting the last error)
>
> Oh, and this recursivity I believe it's caused because setfield will
> eval 'object.fieldname = value' which will go back to the class
> subsasgn that called it on the first place.
>
> Carnë
It has been a while since I looked at the details of Octave's m-file objects,
but what happens if you replace ...
inPar = setfield (inPar, idx.subs, rhs);
... with ...
inPar.(idx.subs) = rhs;
Ben