Convert 1*1 struct file into a csv file

7 ビュー (過去 30 日間)
Battery Fan
Battery Fan 2021 年 4 月 5 日
コメント済み: Battery Fan 2021 年 4 月 8 日
Hi everyone,
I am new to Matlab. I want to convert the .mat file info a csv file with several columns, so that I can read into dataframe by Python.
It doesn't work with csvwrite command. Can anyone teach me how to do this? Thank you very much! I've attached the .mat file.
  2 件のコメント
Sajid Afaque
Sajid Afaque 2021 年 4 月 5 日
your struct contains main fields inside containing many subfields. what exaclty do you want to store in csv
Battery Fan
Battery Fan 2021 年 4 月 8 日
Right. I have extract data and use the subfield name as the colunm name. Thank you.

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

採用された回答

Anmol Dhiman
Anmol Dhiman 2021 年 4 月 7 日
Hi Xueliu,
The structure that you shared is a nested one. Also you haven't specified the fieldnames that you wish to have in csv file. As the structure is nested , I suggest the best way is to write code for accessing structure elements. For that you can refer to this link.
The best way if the structure is not nested is to convert struct to table and then use writetable.
Hope it helps
  1 件のコメント
Battery Fan
Battery Fan 2021 年 4 月 8 日
Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by