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 |