exporting table to specific excel sheet

1 visualizzazione (ultimi 30 giorni)
Tali Leibovich
Tali Leibovich il 14 Apr 2016
Commentato: Azzi Abdelmalek il 14 Apr 2016
Hi
I want to save several tables into the same xlsx file, but in different sheets
that I can also name (name with meaning instead of sheet1...).
If anyone knows how to do it, that would be great!
Thank you (:
Tali

Risposte (1)

Azzi Abdelmalek
Azzi Abdelmalek il 14 Apr 2016
Modificato: Azzi Abdelmalek il 14 Apr 2016
for k=1:3
A=randi(4,4);
xlswrite('file.xlsx',A,sprintf('name%d',k))
end
  3 Commenti
Walter Roberson
Walter Roberson il 14 Apr 2016
writetable('file.xlsx', A, 'Sheet', sprintf('name%d',k));
Azzi Abdelmalek
Azzi Abdelmalek il 14 Apr 2016
Convert a table to a cell array
for k=1:3
A=cell2table(num2cell(randi(4,4)));
B=table2cell(A)
xlswrite('file.xlsx',B,sprintf('name%d',k))
end

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by