help-octave
[Top][All Lists]
Advanced

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

Re: using setfield with an object (getting an error)


From: Carnë Draug
Subject: Re: using setfield with an object (getting an error)
Date: Sun, 2 Oct 2011 18:21:47 +0100

2011/10/2 Ben Abbott <address@hidden>:
> 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

This works perfectly. Thank you very much.

Carnë


reply via email to

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