Error when synchronizing two time series

11 views (last 30 days)
I have two time series, i would like to synchronize them, in each series i have two columns (the first with date and second with data), i used thos code to synchronize (my aim is to delete data with different dates).
SP=readtable('SP dated.xlsx');
CAC40=readtable('CAC40 dated.xlsx');
t1 = SP(:,1);
tsr1=timeseries(SP,t1);
i get an error
Error using timeseries/init (line 174) The first argument must contain the data.
Error in timeseries (line 324)
this = init(this,varargin{:});
I have matlab R2015a
Bests
  2 Comments
John BG
John BG on 2 Mar 2018
Edited: John BG on 2 Mar 2018
Hi Tilfani
would you please be so kind to attach the Excel files 'SP dated.xlsx' and 'CAC49 dated.xlsx'?
If too large files or don't want to publish contents, would it be possible for you edit just a few lines and make them available attached to your question?
prompt availability of input data helps readers supply satisfactory answers.

Sign in to comment.

Answers (1)

Jeremy Hughes
Jeremy Hughes on 2 Mar 2018
Hi, I think this is a simple fix, this code may not do what you think it's doing:
t1 = SP(:,1); % is a table
I don't think timeseries accepts table inputs. What you probably want is:
t1 = SP{:,1}; % is the data in the table
If you were in a more recent version, I would also point you to timetable. https://www.mathworks.com/help/matlab/timetables.html
HTH
Jeremy

Categories

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