Reading a large csv and converting to timetable

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

KSSV
KSSV 2020년 4월 30일
Did you try readtable?
Louise Wilson
Louise Wilson 2020년 4월 30일
편집: Louise Wilson 2020년 4월 30일
Yeah, I have tried with readtable() but the problem is that in this format I get a message when I try to preview and it takes ~10 min to preview using head(table)
Cannot display summaries of variables with more than 524288 elements.
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.
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일

2 개 추천

tt.Var1=datetime(tt.Var1, 'ConvertFrom','datenum');

댓글 수: 2

darova
darova 2020년 4월 30일
You can accept your own answer so it could help someone else
Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Time Series Objects에 대해 자세히 알아보기

제품

릴리스

R2019a

질문:

2020년 4월 30일

댓글:

2020년 8월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by