Export the nested structure from Matlab to excel

how to export the nested structure changed thier values within a loop from Matlab to excel
I tried struct2table also xlswrite but both not working please if any one can help

4 件のコメント

Monika Jaskolka
Monika Jaskolka 2021 年 6 月 26 日
Can you provide your data in a mat file?
Jan
Jan 2021 年 6 月 26 日
"not working" is no clear description of the problem. Di you get an error message? If so, which one?
I cannot guess what you expect as output in Excel for a nested struct. What do you want to see there?
Maha AlSadoon
Maha AlSadoon 2021 年 6 月 26 日
I want the acual data to be store in excel for analysis
the two comments as follows
Walter Roberson
Walter Roberson 2021 年 6 月 26 日
Okay, so suppose I have a table that contains a variable named node and node is a 1 x 5 struct. And suppose that node is
t = table(struct('Label', {'A', 'B', 'C', 'D', 'E'}, 'X', [1, 2, 3, 1 2], 'Y', [1, 4, 3, 2,4]), 5, 'variablenames', {'node', 'numNode'})
t = 1×2 table
node numNode ____________ _______ [1×5 struct] 5
So.. how should this be represented in Excel?

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 6 月 26 日

0 投票

You would have to encode each struct entry in "node" as text. There is a limit of 32767 characters per cell entry in Excel.
struct can be arbitrarily complex. If you have an external interface definition for encoding structures, then use that. If you do not -- if you just need to be able to read the struct back from excel into MATLAB and no other program needs to access it, then you could use https://www.mathworks.com/matlabcentral/fileexchange/34564-fast-serialize-deserialize

質問済み:

2021 年 6 月 26 日

コメント済み:

2021 年 6 月 26 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by