GUIDE uitable saved to excel WITH column headings

1 次查看(过去 30 天)
Whats the best way to save a GUIDE uitable to an excel file. The uitable consists of doubles and I need to include the headings in the excel file. I used to use xlswrite but the documentation suggest to use writematrix or write table but i cannot get the headings. I would also need to be able to then read in the excel data as well as the headings.
Thanks
Jason
  3 个评论
Jason
Jason 2019-10-16
Hello. Yes i used to do this as per link but the recomnendation now is NOT to use xlswrite Thanks
Jalaj Gambhir
Jalaj Gambhir 2019-10-16
In the example cited in the above link, writecell works correctly as well, because 'CombData' is a cell array (the reason why writematrix and writetable does not work). You can combine your column headings (character data) and double data in a cell array, and you can use writecell.
LastName = {'Smith';'Johnson';'Williams';'Jones';'Brown'};
Age = [38;43;38;40;49];
Height = [71;69;64;67;64];
Weight = [176;163;131;133;119];
BloodPressure = [124 93; 109 77; 125 83; 117 75; 122 80];
T = table(LastName,Age,Height,Weight,BloodPressure);
writetable(T,'myData.xls');
Using the above example you can create headings as the variable names such as LastName, Age, etc.

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by