MATLAB Answers

save a structur to xlsx or txt

2 ビュー (過去 30 日間)
roux terence
roux terence 2016 年 5 月 25 日
コメント済み: Todd Leonhardt 2016 年 5 月 25 日
Hello everybody,
I have a structure with lots of datas and I would like to to save all this datas in a xlsx or a txt.
I have Joint(2).FE Joint(2).AA Joint(2).IER
Joint 2 3 4 5 And all this Joint has 3663 raws.
Is it posible to tranfer all this data into a txt or a xlsx.
Thank you

回答 (1 件)

Todd Leonhardt
Todd Leonhardt 2016 年 5 月 25 日
編集済み: Todd Leonhardt 2016 年 5 月 25 日
There are many ways to solve this problem. My recommendation is as follows:
% Convert struct to Table, where your struct is saved in variable S
T = struct2table(S);
% Save data as a CSV file with name of file stored in variable filename
writetable(T, filename);
For more info, see:
A CSV (comma-separated variable) file has many advantages, including:
  • Directly readable by Excel
  • Easy to read/parse in any programming language
  • Human readable
  2 件のコメント
Todd Leonhardt
Todd Leonhardt 2016 年 5 月 25 日
The solution I gave you is intended to write a CSV file, not an Excel file. If you really want to write an Excel file, use xlswrite():

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by