Hi guys,
I have started to use struct to create nested arrays which will be assigned in a second time , for example:
S = struct( ... 'A', struct( ... 'A_ID', struct( ... 'C', [], ... 'D', [], ... 'E', struct( ... 'EF',[], ... 'EG',[], ... 'EH',[], ... 'EI',[]))));
but when i try to assign the object values, something strange happens, the substructure information disappeares. For examples i assign to the first postion of the object A_ID the value of C = 'test1'
S.A.A_ID(1).C='test1'
and i obtain
S.A.A_ID(1) =
- C: 'test1'
- D: []
- E: [1×1 struct]
now if i assign a new value for C in a new position of A_ID for example
S.A.A_ID(2).C='test2'
i don't obtain
S.A.A_ID(2) =
- C: 'test2'
- D: []
- E: [1×1 struct]
but
S.A.A_ID(2) =
- C: 'test2'
- D: []
- E: []
and i lost all the information contained in the nested struct E !!
i don't really understand why, have someone an idea??
thank's in advance
Luca
Best Answer