MATLAB Answers

hdg D

consolidate all fields in a structure

Asked by hdg D
on 21 Aug 2013

hello, This agian is a consolidation question if I have a set of fields in a structure

say I have a structure mystruct which is a 1x2

struct array with fields


but say my field name has fields too so


and perhaps my firstname could have additonal fields


At the end I want to consolidate all this information into a single BigStruct = [mystruct(1).name.firstname, mystruct(2).name.firstname ..etc] = [mystruct(1).name.lastname, mystruct(2).name.lastname ..etc] =[mystruct(1).id, mystruct(2).id ..]

The assumption is they are all the same length so they can be concatenated.. How do I do this without having to specifiy each field or sub fields

Thanks so much! HD


Log in to comment.

0 Answers

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!