[Top][All Lists]

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

RE: structure discussion

From: Paul Billings
Subject: RE: structure discussion
Date: Tue, 11 Oct 2005 11:16:00 -1000

[g is an array of structures]
> So if you have an array of structures you cannot set all the whole array
> of a structure element to a single value unless the array element
> already exist...however you can set a slice of the array.  I guess it is
> In summary I think that g(:).a = value should set all currently defined
> indices for the array of structures g to value and g.b = value should
> set the first index to value and all other currently defined indices to
> undef.  What do you all think?

Perhaps a more concise example: with version 2.1.71,
   clear g; g(1).a = g(2).a = 1;
   g(:).a = 2;  % does what you'd expect (both .a values are changed)
   g(:).b = 1   % does NOT do what I would expect

I agree Colin, I would expect that both .b values should be set when calling
g(:).b = 1 regardless of the existance of .b.

I disagree with your second point: I think the notation "g.b = 1" is
ambiguous and should be an error regardless of the existance of .b.  This is
the current behavior.  The notation g(1).b = 1 to set the first element only
seems more consistent.


reply via email to

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