Save structure in Excel

3 visualizaciones (últimos 30 días)
Joanna Przeworska
Joanna Przeworska el 4 de Mzo. de 2021
Comentada: Joanna Przeworska el 4 de Mzo. de 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]
...

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by