How to write column headers into Excel files?

I'm trying to generate an Excel file with column headers. Below is my code. Why does the generated file do not containt the column header at all?
File_W = 'Output.xlsx';
col_header={'Depth','Parameter_A'};
xlswrite(File_W, col_header, 'Sheet1', 'B1');
xlswrite(File_W, DATA(:,[1,2]), 'Sheet1', 'B2');

2 个评论

try using array2table and writetable function.
Many thanks.
writetable works.

请先登录,再进行评论。

回答(0 个)

产品

版本

R2019b

提问:

2020-1-27

评论:

2020-1-27

Community Treasure Hunt

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

Start Hunting!

Translated by