struct to excel data saving

41 ビュー (過去 30 日間)
Mudasser Seraj
Mudasser Seraj 2018 年 2 月 6 日
コメント済み: Caoimhe Madine 2020 年 4 月 2 日
Hi, I have a 15x3x5 struct with 12 fields. I want to save all the data inside the structure in excel with one sheet for each field. How can I do that?
  1 件のコメント
Fangjun Jiang
Fangjun Jiang 2018 年 2 月 6 日
Your array size is 15x3x5. There is no way in Excel that can represent this three dimensional size. I would suggest you making it 225 (the number of structures) by 12 (the number of fields) array. You can write this array in one Excel sheet.

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

採用された回答

Fangjun Jiang
Fangjun Jiang 2018 年 2 月 6 日
S=[Cars(:)];
writetable(struct2table(S),'test.xlsx');
winopen test.xlsx
  1 件のコメント
Mudasser Seraj
Mudasser Seraj 2018 年 2 月 6 日
Thank you so much. It worked well.

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

その他の回答 (1 件)

Raj Sodhi
Raj Sodhi 2019 年 9 月 29 日
I found that my struct had sub-structs and those structs had arrays within those elements. So I wrote a little better solution that might be worth sharing. See attached function.
Yours,
Raj
  1 件のコメント
Caoimhe Madine
Caoimhe Madine 2020 年 4 月 2 日
Would you be able to give some guidance on where in this code you input your own files and names. It is not quite clear to me

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

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by