"Is there any more elegant way which does not use temporary variable and might be coded into one line?"
No.
You could use arrayfun, but in my opinion this is much less elegant:
>> arrayfun(@(s)s.my_field(1),my_struct) ans = 11 21
"Is there any more elegant way which does not use temporary variable and might be coded into one line?"
No.
You could use arrayfun, but in my opinion this is much less elegant:
>> arrayfun(@(s)s.my_field(1),my_struct) ans = 11 21
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!