How to include header text in a Table when writing to Excel?

8 次查看(过去 30 天)
Hi All
I have to write a table after converting it to array , to Excel . as you can see in the following example taken from this page, if you print the TT you can see the header. but when I converted it to array and tried to write it to Excel ,there was no header
[c,hist,edges,rmm,idx] = rainflow(Z,t);
TT = array2table(c,'VariableNames',{'Count','Range','Mean','Start','End'})
TT=7×5 table
Count Range Mean Start End
_____ _____ ____ _____ ___
0.5 3 -0.5 0 1
0.5 4 -1 1 3
1 4 1 5 6
0.5 8 1 3 4
1 6 1 10 13
0.5 9 0.5 4 8
0.5 10 1 8 15

采纳的回答

Bhaskar R
Bhaskar R 2019-12-26
In table to array conversion only one type of the data will be displayed, head(string) would skipped.
If you want to write data to excel without converting table to array you can include header
writetable(TT,'output_file.xlsx'); % assumed filename "output_file"
  2 个评论
farzad
farzad 2019-12-26
I get this error :
Error using writetable (line 124)
Unable to write to sheet '' in file 'Ystat.xlsx'. Disable sheet protection, disable workbook's Mark as Final
option, and ensure input does not exceed cell capacity.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by