help-octave
[Top][All Lists]
Advanced

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

setfield behavior changed?


From: Frans Oliehoek
Subject: setfield behavior changed?
Date: Thu, 06 Nov 2014 13:40:07 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.8.1

Hi all,


Digging up some old code, it seems that I am using old syntax (?) to set field values. Roughly my problem is that I get this:


octave:1> s.a.b = 2
s =
  scalar structure containing the fields:
    a =
      scalar structure containing the fields:
        b =  2


octave:2> s = setfield(s,'a.b', 42)
s =
  scalar structure containing the fields:
    a =
      scalar structure containing the fields:
        b =  2
    a.b =  42



Clearly, I want to realize the behavior of (new syntax)

octave:3> s = setfield(s,'a', 'b', 42)
s =
  scalar structure containing the fields:
    a =
      scalar structure containing the fields:
        b =  42
    a.b =  42

However, if possible, I would not want to use the new syntax ('a.b' is passed in by a variable, and it could be 'c', or 'a.b.c', and I want all those cases to work without having to use different syntax...). Does anyone have a workaround?

Thanks!
-Frans




reply via email to

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