GUIDE uitable saved to excel WITH column headings

2 views (last 30 days)
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 Comments
Jason
Jason on 16 Oct 2019
Hello. Yes i used to do this as per link but the recomnendation now is NOT to use xlswrite Thanks
Jalaj Gambhir
Jalaj Gambhir on 16 Oct 2019
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.

Sign in to comment.

Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!