How to keep Excel template format when using writetable

Hi. I,m trying to export my data to Excel file by using writetable function, but when I use this function, the destination file format will be reset. How should I do to keep the template format unchanged?

回答(1 个)

t = readtable ('testFile.xlsx')
t.Var2(1,:) = 4
writetable(t,'testFile.xlsx');

2 个评论

It works when I use Matlab R2014a and Excel 2010. But on my laptop, I use Matlab R2018b and Excel 2016 and it doesn't work. The table will be written on Excel file bu the template format will be deleted.
I use 2018b matlab and excel 2016 , it works in mine but no idea what’s the mystery behind yours

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Data Import from MATLAB 的更多信息

提问:

2018-10-28

编辑:

2018-10-29

Community Treasure Hunt

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

Start Hunting!

Translated by