Subplot with table of datetime and double

Starting point:
  • 'n' different data sets, with different start dates, but with the same end day (today)
  • all 'n' tables have a column 'Date' in datetime, with format yyyyMMdd, and a number of other columns, which are of type 'double', where just one column is of interest to extract. Which can be called X.
The problem is to make a general code:
  1. I want to decide the timerange to extract by taking the shortest dataset, and adjust all other sets down to the same range. something like the following: start_date = max[table1.date(1) table2.date(1)..... table'n'.date(1)]. end_date = table.date(end).
  2. Create a new timetable with range (start_date : end_date). This table should inlude: The dates AND the corresponiding 'X' column from all 'n' tables.

 采纳的回答

Turn your table arrays into timetable arrays using table2timetable. Once you have a collection of timetable arrays, synchronize them. You'd want to specify that you want to use either the 'intersection' or the 'commonrange' of the times as the new time basis.

2 个评论

Would you have a sugguestion to how to write this code ?
Start off by looking at the examples on the table2timetable and synchronize documentation pages. See if you can adapt one or more of those examples to your data. If none of them seem close enough for you to determine how to use them for your data, show us what you've tried and we may be able to suggest minor modifications to your code.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by