I'd like to take two structures and make a new structure whose fields are
the (union of) the fields of the two original structures. I've tried playing
with dynamic field names using the .(expression) notation and the fieldnames
function, but the expression must resolve into a single field name, not a
comma-separated list. I get this error...
a =Quote:>> a.b=1
a =Quote:>> a.c=2
??? Argument to dynamic structure reference must evaluate to a valid fieldQuote:>> a.(fieldnames(a)) = pi
I see how it could be done with struct, fieldnames, and struct2cell, but
that's pretty messy. Does anyone know/see a better way?
Mathworks, is this a capability you could include in the future?