How do I separate month, day of the week, and hour of the day for each row of a csv time series file so that I can do a factor analysis for month, day, hour?

조회 수: 1 (최근 30일)
How do I separate month, day of the week, and hour of the day for each row of a csv time series file so that I can do a factor analysis for month, day, hour? I'm trying to determine the best time to enter/exit FX trades by day and hour of the day, but I'm not sure how to format the data file. Can you help me?
  댓글 수: 1
the cyclist
the cyclist 2017년 10월 19일
Please don't make us guess at what your data looks like, when it is so easy to upload a sample. Make it easy for us to help you.

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

채택된 답변

KL
KL 2017년 10월 19일
편집: KL 2017년 10월 19일
Use a timetable!
Import your csv file as table and then create a timetable from it .Then you can do whatever you want to do with it, like monthly mean, yearly sum, etc. For example,
data_table = readtable('yourfile.csv');
data_timetable = table2timetable(data_table);
and then you could use retime
hourly_mean_table = retime(data_timetable,'hourly','mean')
  댓글 수: 2
Peter Perkins
Peter Perkins 2017년 10월 22일
In addition to using retime to compute per-period summaries, if you want to "do a factor analysis for month, day, hour", you may also want to add new variables in that timetable, something like
data_timetable.Month = month(data_timetable.Time)
data_timetable.DayOfWeek = day(data_timetable.Time,'dayofweek')
etc.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by