Two "Time" colunm in a time table

1 view (last 30 days)
Hello I have two groups of "Dates", one is the "buy-date" and the other is the "sell-date"
I want to add this two "rowTime" to a timetable. But timetables admits just one rowTime
The following code, doesn't work.
Buy_Dates = datetime(BuyDate);
Sell_Dates = datetime(SellDate);
TT_Trades = table2timetable(T_Trades, 'RowTimes', Buy_Dates, 'RowTimes', SellDate);
Thank you.

Accepted Answer

Peter Perkins
Peter Perkins on 19 Jun 2019
Edited: Peter Perkins on 19 Jun 2019
Correct, there is only one vector of times to label the rows of a timetable. But that's not to say you can't put both vectors in a timetable, just that only one of them can be the "row times". Just add the other one as an ordinary timetable variable, on the same footing as T_Trades.
The row times in a table are special because those are the ones used for subscripting by time. I can't say which of your two vectors is the more "fundamental" one, or which one should be the row times. Maybe neither one is more fundamental, so maybe you want a table (not a timetable) two of whose variables are datetime vectors. But I would think you'd want to make a timetable and choose one of the two as your row times.

More Answers (0)

Categories

Find more on Tables 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!