Save Struct to Excel file

39 vues (au cours des 30 derniers jours)
Tim Fabian Zimmermann
Tim Fabian Zimmermann le 26 Oct 2021
Hey There,
im doing fricntion tests at my institute for my thesis and i have a struct which and i tried everything to save it as an .xlsx excel-file
Here is one way i tried:
fname_11 = '/Excel/Alle_Ergebnisse.xlsx';
writetable(struct2table(summary), [pwd fname_11]);
the struct is in my workplace like u can see in the screenshot.
and nothing worked. Does anyone has a clue how i can solve it? Im still new to Matlab, so sorry for the inconvinience.
  2 commentaires
Matt J
Matt J le 26 Oct 2021
What do you mean it didn't work? What happened with writetable when you tried it?
Tim Fabian Zimmermann
Tim Fabian Zimmermann le 26 Oct 2021
Sorry,
i get the following Error:
"Writing nested tables/timetables is not supported. Use SPLITVARS on the nested table before writing."
Each of the Struct tables contains three values like this:

Connectez-vous pour commenter.

Réponse acceptée

Tim Fabian Zimmermann
Tim Fabian Zimmermann le 26 Oct 2021
I did it with an table now, defining my talbe befor the loop as
varTypes = {...
'string',...
'doubleNaN',...
'doubleNaN',...
'doubleNaN',...
} ;
Zusammenfassung=...
table('Size',[counter_folder 4],...
'VariableTypes',varTypes,...
'VariableNames',{'Versuch','Mean_Fn', 'Mean_Ft', 'Mean_mu'}...
);
and collected the values at the end like:
Zusammenfassung{i,1}=convertCharsToStrings(data_name);
Zusammenfassung{i,2}=Ergebnisse.Mittelwerte.Mean_Fn;
Zusammenfassung{i,3}=Ergebnisse.Mittelwerte.Mean_Ft;
Zusammenfassung{i,4}=Ergebnisse.Mittelwerte.Mean_mu;
after that i exported it to excel with writtable
fname_11 = '/Excel/Alle_Ergebnisse.xlsx';
writetable(Zusammenfassung, [pwd fname_11]);
thx for all your help guys!

Plus de réponses (1)

Can Atalay
Can Atalay le 26 Oct 2021
Modifié(e) : Can Atalay le 26 Oct 2021
Since you said you were new I'm assuming you couldn't extract the tables before writing to an excel file. For instance you could access the tables using
v_7_temp = summary.v7vc10fn122;
class(v_7_temp)
and write the table to an excel file as usual.
How do you want the excel file result to look like though? A clickable cell that opens up multiple files or just a simple table view?
  3 commentaires
Tim Fabian Zimmermann
Tim Fabian Zimmermann le 26 Oct 2021
Due to tha fact that i have several hundreds of tests with different parameter sets, it would be perfect to use the nested coulmn desctribtion like "v100vc40fn137" as the Test number
Can Atalay
Can Atalay le 26 Oct 2021
I don't work with excel files often so I'm not sure I understand what you're after. Maybe if you attached a hand drawing of what the xls file should look like and explain it like I'm a 3 year old I may be able to help :P sorry

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by