From: Etienne G. <et...@cs...> - 2004-03-30 19:51:21
|
Hi all, I use, octave 2.1.53, cvs octave-forge, so my prob could be due to not using 2.1.57. Is that the desired behavior of struct()? Are those bugs introduced between r 1.2 and r 1.3 of struct.cc? ====================================================================== octave:3> struct ("a",{1},"b",{1,2}) ans = { a = (, [1] = 1 [2] = 1 ,) b = (, [1] = 1 [2] = 2 ,) } octave:4> struct ("a",{1},"b",{1,2},"c",{}) error: struct: dimensions of parameter 4 do not match those of parameter 6 octave:4> struct () *** struct: struct('field',value,'field',value,...) Create a structure and initialize its value. struct('field',{values},'field',{values},...) Create a structure array and initialize its values. The dimensions of each array of values must match. Singleton cells and non-cell values are repeated so that they fill the entire array. struct('field',{},'field',{},...) Create an empty structure array. ====================================================================== Once upon a time, struct() returned an empty struct, without need to do struct([]). No field-value pair -> empty struct, right? I don't recall that there's anything wrong with having struct values being lists, my code has relied on this for some time now. Any tips welcome, Etienne -- Etienne Grossmann ------ http://www.cs.uky.edu/~etienne |
From: Etienne G. <et...@cs...> - 2004-03-30 20:26:11
|
Hi again, sorry to answer to myself. I guess the effect I described in my previous mail are due to an attempt to imitate the other brand, which behaves like: ====================================================================== >> a = struct('x',{1},'y',{1,2}) a = 1x2 struct array with fields: x y >> a.x ans = 1 ans = 1 >> a.y ans = 1 ans = 2 ====================================================================== Hmm. So no more structs taking lists as values? I mean 'cells as values', since lists seem to be doomed? Etienne On Tue, Mar 30, 2004 at 02:51:12PM -0500, Etienne Grossmann wrote: # # Hi all, # # I use, octave 2.1.53, cvs octave-forge, so my prob could be due to not # using 2.1.57. # # Is that the desired behavior of struct()? Are those bugs introduced # between r 1.2 and r 1.3 of struct.cc? # # ====================================================================== # octave:3> struct ("a",{1},"b",{1,2}) # ans = # { a = # (, # [1] = 1 # [2] = 1 # ,) # # b = # (, # [1] = 1 # [2] = 2 # ,) # } # # octave:4> struct ("a",{1},"b",{1,2},"c",{}) # error: struct: dimensions of parameter 4 do not match those of parameter 6 # octave:4> struct () # # *** struct: # # struct('field',value,'field',value,...) # # Create a structure and initialize its value. # # struct('field',{values},'field',{values},...) # # Create a structure array and initialize its values. The dimensions # of each array of values must match. Singleton cells and non-cell values # are repeated so that they fill the entire array. # # struct('field',{},'field',{},...) # # Create an empty structure array. # ====================================================================== # # Once upon a time, struct() returned an empty struct, without need to # do struct([]). No field-value pair -> empty struct, right? # # I don't recall that there's anything wrong with having struct values # being lists, my code has relied on this for some time now. # # Any tips welcome, # # Etienne # # -- # Etienne Grossmann ------ http://www.cs.uky.edu/~etienne -- Etienne Grossmann ------ http://www.cs.uky.edu/~etienne |
From: Paul K. <pki...@us...> - 2004-03-31 00:36:27
|
Yes, I did do a number of compatibility changes. struct with these changes is now part of octave. Sorry for breaking things... Does the new interface do everything you need? Or is there some way we can extend it to do what you need? I don't remember why I didn't enable the obvious behaviour of struct() creating an empty struct. - Paul On Mar 30, 2004, at 3:26 PM, Etienne Grossmann wrote: > > Hi again, sorry to answer to myself. I guess the effect I described > in my previous mail are due to an attempt to imitate the other brand, > which behaves like: > ====================================================================== >>> a = struct('x',{1},'y',{1,2}) > > a = > 1x2 struct array with fields: > x > y > >>> a.x > > ans = > 1 > ans = > 1 > >>> a.y > > ans = > 1 > ans = > 2 > ====================================================================== > > Hmm. So no more structs taking lists as values? I mean 'cells as > values', since lists seem to be doomed? > > Etienne > > On Tue, Mar 30, 2004 at 02:51:12PM -0500, Etienne Grossmann wrote: > # > # Hi all, > # > # I use, octave 2.1.53, cvs octave-forge, so my prob could be due to > not > # using 2.1.57. > # > # Is that the desired behavior of struct()? Are those bugs introduced > # between r 1.2 and r 1.3 of struct.cc? > # > # > ====================================================================== > # octave:3> struct ("a",{1},"b",{1,2}) > # ans = > # { a = > # (, > # [1] = 1 > # [2] = 1 > # ,) > # > # b = > # (, > # [1] = 1 > # [2] = 2 > # ,) > # } > # > # octave:4> struct ("a",{1},"b",{1,2},"c",{}) > # error: struct: dimensions of parameter 4 do not match those of > parameter 6 > # octave:4> struct () > # > # *** struct: > # > # struct('field',value,'field',value,...) > # > # Create a structure and initialize its value. > # > # struct('field',{values},'field',{values},...) > # > # Create a structure array and initialize its values. The dimensions > # of each array of values must match. Singleton cells and non-cell > values > # are repeated so that they fill the entire array. > # > # struct('field',{},'field',{},...) > # > # Create an empty structure array. > # > ====================================================================== > # > # Once upon a time, struct() returned an empty struct, without need > to > # do struct([]). No field-value pair -> empty struct, right? > # > # I don't recall that there's anything wrong with having struct > values > # being lists, my code has relied on this for some time now. > # > # Any tips welcome, > # > # Etienne > # > # -- > # Etienne Grossmann ------ http://www.cs.uky.edu/~etienne > > -- > Etienne Grossmann ------ http://www.cs.uky.edu/~etienne > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Octave-dev mailing list > Oct...@li... > https://lists.sourceforge.net/lists/listinfo/octave-dev > |
From: Etienne G. <et...@cs...> - 2004-03-31 13:03:30
|
Hi all, maybe we could have an ostruct() with the old behavior? If stinckin' matlab doesn't do structs that take lists as values, should we be deprived of them? For now I rm'd struct.cc and use good'ol struct.m that behaves as I want. Etienne On Tue, Mar 30, 2004 at 07:36:03PM -0500, Paul Kienzle wrote: # Yes, I did do a number of compatibility changes. struct with these # changes is now part of octave. # # Sorry for breaking things... # # Does the new interface do everything you need? Or is there # some way we can extend it to do what you need? # # I don't remember why I didn't enable the obvious behaviour of # struct() creating an empty struct. # # - Paul # # On Mar 30, 2004, at 3:26 PM, Etienne Grossmann wrote: # # > # > Hi again, sorry to answer to myself. I guess the effect I described # >in my previous mail are due to an attempt to imitate the other brand, # >which behaves like: # >====================================================================== # >>>a = struct('x',{1},'y',{1,2}) # > # >a = # >1x2 struct array with fields: # > x # > y # > # >>>a.x # > # >ans = # > 1 # >ans = # > 1 # > # >>>a.y # > # >ans = # > 1 # >ans = # > 2 # >====================================================================== # > # > Hmm. So no more structs taking lists as values? I mean 'cells as # >values', since lists seem to be doomed? # > # > Etienne # > # >On Tue, Mar 30, 2004 at 02:51:12PM -0500, Etienne Grossmann wrote: # ># # ># Hi all, # ># # ># I use, octave 2.1.53, cvs octave-forge, so my prob could be due to # >not # ># using 2.1.57. # ># # ># Is that the desired behavior of struct()? Are those bugs introduced # ># between r 1.2 and r 1.3 of struct.cc? # ># # ># # >====================================================================== # ># octave:3> struct ("a",{1},"b",{1,2}) # ># ans = # ># { a = # ># (, # ># [1] = 1 # ># [2] = 1 # ># ,) # ># # ># b = # ># (, # ># [1] = 1 # ># [2] = 2 # ># ,) # ># } # ># # ># octave:4> struct ("a",{1},"b",{1,2},"c",{}) # ># error: struct: dimensions of parameter 4 do not match those of # >parameter 6 # ># octave:4> struct () # ># # ># *** struct: # ># # ># struct('field',value,'field',value,...) # ># # ># Create a structure and initialize its value. # ># # ># struct('field',{values},'field',{values},...) # ># # ># Create a structure array and initialize its values. The dimensions # ># of each array of values must match. Singleton cells and non-cell # >values # ># are repeated so that they fill the entire array. # ># # ># struct('field',{},'field',{},...) # ># # ># Create an empty structure array. # ># # >====================================================================== # ># # ># Once upon a time, struct() returned an empty struct, without need # >to # ># do struct([]). No field-value pair -> empty struct, right? # ># # ># I don't recall that there's anything wrong with having struct # >values # ># being lists, my code has relied on this for some time now. # ># # ># Any tips welcome, # ># # ># Etienne # ># # ># -- # ># Etienne Grossmann ------ http://www.cs.uky.edu/~etienne # > # >-- # >Etienne Grossmann ------ http://www.cs.uky.edu/~etienne # > # > # >------------------------------------------------------- # >This SF.Net email is sponsored by: IBM Linux Tutorials # >Free Linux tutorial presented by Daniel Robbins, President and CEO of # >GenToo technologies. Learn everything from fundamentals to system # >administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click # >_______________________________________________ # >Octave-dev mailing list # >Oct...@li... # >https://lists.sourceforge.net/lists/listinfo/octave-dev # > # -- Etienne Grossmann ------ http://www.cs.uky.edu/~etienne |