Supposing I have an array of structures X, where each element of the array

has fields .th and .r. I can refer to a particular field like "X(3).r" if I want to

know its value, but is there a way to refer to ALL the r fields in the array as

a group, like "X(:).r"? This just gets me the value of the r field of the first

element of the array for some reason:

>> X(1).th = 23;

>> X(1).r = 10.3;

>> X(2).th = 17;

>> X(2).r = 6.6;

>> X(3).th = 47;

>> X(3).r = 11.5;

>> X(:).r % (or X.r)

ans = 10.300

ans = 6.6000

ans = 11.500

>> % This shows me all the values, but...

>> foo = X(:).r

foo = 10.300 % Assignment only gets me the first one. I expected:

>> foo

foo =

10.3000 6.6000 11.5000

Using a loop is the obvious option, but I am just wondering if there is a better

way, or a better construct.

Thanks for any advice you can give me.

Regards,

Allen

--

Allen Windhorn P.E. (Mn), CEng| Senior Principal Engineer

Leroy-Somer Americas | Kato Engineering, Inc.

2075 Howard Dr. West | North Mankato, MN 56003 | USA

T +1 507-345-2782 | F +1 507-345-2798

[hidden email] |

[hidden email]