Info

# Order in combined financial time series

1 view (last 30 days)
Dominik on 8 Apr 2013
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello,
I have the following problem:
I create a fts for each security and simply name it s1,s2,...,s30 just by the index k of the loop.
for k=1:z
prices_fts{1,k}=fints(prices_sort{1,k}(:,1),prices_sort{1,k}(:,2),['s' num2str(k)]);
end
So far so good.
Now I merge all fts to one.
all_fts=prices_fts{1,1};
for k=1:z
all_fts=merge(all_fts, prices_fts{1,k});
end
Here comes the problem: instead of sorting it straight from 1 to 30, the order of the single series in the merged series is 1,11,12,13,14,15,16,17,18,19,20,21,...,3,30,31. It's all sorted by the first number.
I didn't find anything about sorting it rigth. I am thankful if somebody can help me.
Dominik

Leah on 8 Apr 2013
I don't have the financial toolbox, so it's hard to know exactly what's going on. You can use orderfields and specify an array with the order you want.
It might work to merge all at once instead of in a loop, but it seems like the sort is happening inside merge.