Problem 2252. Create matrix with common dates from a number of structs -inner join on dates

Do an "inner join" (as in SQL) on a number of structs where the ".date" is the date and the ".ts" the timeseries. The join is on common dates and the result is a matrix which has as first column the common dates and the following columns are the data points from the matrices. For example n=2

X(1).date=[73502 73503 73504 73505 73506 73507];
X(1).ts=[100 101 102 102 101 100];
X(2).date=[73503 73504 73506 73507 73508];
X(2).ts=[101 99 100 98 99];

Resulting into a matrix with n+1 columns

Y=[73503 101 101;
   73504 102 99;
   73506 101 100;
   73507 100 98]

The number n is the number of datasets X(1) ... X(n)

Solution Stats

60.0% Correct | 40.0% Incorrect
Last solution submitted on Nov 17, 2014
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more