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.

 採用された回答

Steven Lord
Steven Lord 2021 年 3 月 25 日

0 投票

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 件のコメント

Andreas Bull
Andreas Bull 2021 年 3 月 25 日
Would you have a sugguestion to how to write this code ?
Steven Lord
Steven Lord 2021 年 3 月 25 日
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 ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by