Save structure in Excel

3 visualizzazioni (ultimi 30 giorni)
Joanna Przeworska
Joanna Przeworska il 4 Mar 2021
Dear all,
I have a structure, which I want to save in Excel, in a way that each table is saved in different Excel sheet. Could you please help me with programming it?
dataset =
struct with fields:
Credit_broad: [205×48 table]
Credit_narrow: [205×48 table]
TotC_HH: [205×48 table]
TotC_NFC: [205×48 table]
GDP: [205×48 table]
...

Risposta accettata

Stephen23
Stephen23 il 4 Mar 2021
Modificato: Stephen23 il 4 Mar 2021
F = fieldnames(dataset);
N = 'myfile.xlsx';
for k = 1:numel(F)
T = dataset.(F{k});
writetable(T, N, 'Sheet',F{k})
end
  1 Commento
Joanna Przeworska
Joanna Przeworska il 4 Mar 2021
It works as I expected. Thank you very much.
Kind regards,
JP

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by