CL40
CL40

Reputation: 598

Creating array of timetables in MATLAB

I am attempting to do some analysis on a series of timetable objects. Each has a potentially different date range (they represent observations of a time series). I would like to pass this array of timetable objects into a function.

Using the quandl addon:

>> conn = quandl(<YOUR_API_KEY_HERE>);
>> z1 = history(conn, 'ZILLOW/M1300_MPPRSF');
>> z2 = history(conn, 'ZILLOW/M1300_MPPRAH');

Then attempting to take these two time series and group them into an array (NOT join them together):

>> [z1, z2]
Duplicate table variable name: 'Value'.

Is there a method to do this such that I could save a number of timetables into a vector so that I can iterate over them without using varargin in the function?

Thank you.

Upvotes: 0

Views: 1192

Answers (2)

One option would be to create a cell array of the timetables and then use a cellfun to perform your analysis. For example, if you would like to perform the lag calculation on the timetables, you could do the following:

myData = {z1, z2};
myLags cellfun(@lag, myArray);

Upvotes: 0

Paolo
Paolo

Reputation: 26074

You cannot concatenate two timetables horizontally if the names of the variables are identical. I suggest you create a cell array of timetables and use that instead.

>> {z1 z2} 

You might find this doc page on datatypes useful.

Upvotes: 1

Related Questions