some rows appears as text in excel when it should be numerical.

I calculated some data and imorted that to an xlsx sheet. for some odd reason, some rows show as text while others show as numerical.
code is:
Speed_70 = table(mean_speed70_MPH, mean_power70_MPH, mean_force112_KPH);
STD_70 = table(std_speed70_MPH, std_power70_MPH, std_force112_KPH);
CV_70 = table(CV_speed70_MPH, CV_power70_MPH, CV_force112_KPH);
%%Table
Table11 = [Speed_50_1, Speed_55_1, Speed_60_1, Speed_65_1, Speed_70];
Table12 = [STD_50_1, STD_55_1, STD_60_1, STD_65_1, STD_70];
Table13 = [CV_50_1, CV_55_1, CV_60_1, CV_65_1, CV_70];
Table21 = [Speed_50_2, Speed_55_2, Speed_60_2, Speed_65_2];
Table22 = [STD_50_2, STD_55_2, STD_60_2, STD_65_2];
Table23 = [CV_50_2, CV_55_2, CV_60_2, CV_65_2];
writetable(Table11,'Steady_State_027.xlsx','Sheet',1,'Range','A1:O2')
writetable(Table12,'Steady_State_027.xlsx','Sheet',1,'WriteVariableNames',0,'Range','A3:O3')
writetable(Table13,'Steady_State_027.xlsx','Sheet',1,'WriteVariableNames',0,'Range','A4:O4')
writetable(Table21,'Steady_State_027.xlsx','Sheet',1,'Range','A5:O6')
writetable(Table22,'Steady_State_027.xlsx','Sheet',1,'WriteVariableNames',0,'Range','A7:O7')
writetable(Table23,'Steady_State_027.xlsx','Sheet',1,'WriteVariableNames',0,'Range','A8:O8')

3 Comments

May have been something else in the sheet before that left the formatting. AFAICT, writetable doesn't muck with fixing up cell properties but basically leaves as finds...altho that isn't totally true, either. I've never been able to decipher just what it does in that regards and that detail of behavior isn't documented.
Alternatively, perhaps there's something in the data itself or the table...we don't have that to be able to know for sure what the original content is.
Well, a .csv file can contain anything -- we can't see it from here.
We can't debug what we can't see/touch...
Either attach the data that fails or the table you tried to write.
Alternatively, delete the sheet(s) and try again. Will at least eliminate being left over from previous data on the same sheet.

Answers (0)

This question is closed.

Asked:

on 7 Nov 2020

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!