MATLAB Answers

Create cell arrays and variables out of structures

1 view (last 30 days)
Oliver Makan
Oliver Makan on 8 Nov 2019
Edited: Stephen Cobeldick on 12 Nov 2019
Hey guys can you help me please.
I have a structure inside another structure and in this strucutre there are cells with arrays(4x100 double).
I wanted to get these cells out of the structure and convert them to a matrix so that every single array gets an variable for it's own. It's like struct.struct.cell.
I tried a for-loop that indexes the cells but it did not work. Maybe it is possible to get them row-and column-wise.
On the picture you can see the two structures and the cells/fields which I want to convert to variables.
Are there any other solutions ?
Thank you for your help.

  1 Comment

Stephen Cobeldick
Stephen Cobeldick on 8 Nov 2019
Ri_Zelle = SAM.Innenwiderstand.Ri_Zelle;
Ri_fit = SAM.Innenwiderstand.Ri_fit;
SOC = SAM.Innenwiderstand.SOC;
... etc.
"...so that every single array gets an variable for it's own"
That would not be a good approach. Read this to know why:
You might find this useful:

Sign in to comment.

Answers (0)