Writing a struct into a text file (.sto file)

1 回表示 (過去 30 日間)
Mohammadhossein Akhavanfar
Mohammadhossein Akhavanfar 2018 年 2 月 7 日
コメント済み: Rory Turnbull 2020 年 3 月 27 日
Hi, I have a 1*1 struct like this:
str =
data: [11x31 double]
textdata: {15x31 cell}
colheaders: {1x31 cell}
I want to write this struct into a .sto file. An example of this .sto file generated by OpenSim software is like this:
When I import the above .sto file in MATLAB, I got a 1*1 struct like what I produced. Now I want to write my struct into a .sto file. I appreciate it if you could help me we this.
  1 件のコメント
Rory Turnbull
Rory Turnbull 2020 年 3 月 27 日
Did you find an answer to this?

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

回答 (1 件)

Prajit T R
Prajit T R 2018 年 2 月 22 日
Hi
I understand that you wish to convert a struct into a text file. Convert the struct to a table and then use the function write2table as follows:
writetable(struct2table(str), 'str.txt')
You can convert the structure to .txt,.csv and .dat using this method. I'm not certain about .sto files.
Cheers

カテゴリ

Help Center および File ExchangeScope Variables and Generate Names についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by