Reading a large csv and converting to timetable

3 次查看(过去 30 天)
I have a large .csv (7179x72001) where the first column is filled with datenums and the remaining columns are numerical values. The only way I have been successful in reading this data is by using csvread() and it usually takes about 20 minutes.
I have a second .csv which contains the same values but in datetime format and I would like to compare the two.
Is it possible to convert the first column in the large file so that the values are datetimes, and then in turn convert this to a timetable?
I can do this but I only want to convert the first column, not the whole dataframe:
newtable=datetime(dataframe, 'ConvertFrom', 'datenum');
  4 个评论
Louise Wilson
Louise Wilson 2020-4-30
I have just tried this:
thetable=readtable(fullfile(foldername,'001Noises_5103_PSD_1sHammingWindow_50%Overlap_output.csv'));
datetime(thetable.Var1,'ConvertFrom','datenum');
head(thetable)
This doesn't give any errors but the contents of the first column remain as datenums.
Louise Wilson
Louise Wilson 2020-4-30
Ah, I see now that it should be this:
tt.Var1=datetime(tt.Var1, 'ConvertFrom','datenum');
This works! Thanks for your help!!

请先登录,再进行评论。

采纳的回答

Louise Wilson
Louise Wilson 2020-4-30
tt.Var1=datetime(tt.Var1, 'ConvertFrom','datenum');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calendar 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by