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

1 vue (au cours des 30 derniers jours)
Mohammadhossein Akhavanfar
Commenté : Rory Turnbull le 27 Mar 2020
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 commentaire
Rory Turnbull
Rory Turnbull le 27 Mar 2020
Did you find an answer to this?

Connectez-vous pour commenter.

Réponses (1)

Prajit T R
Prajit T R le 22 Fév 2018
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

Catégories

En savoir plus sur Scope Variables and Generate Names dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by