Why am I getting an out of bounds error when using TOMONTHLY function from the Financial Toolbox 3.3 (R2007b) on my timeseries object?

1 view (last 30 days)
I have a timeseries data object which I pass on to the TOMONTHLY function. I am then getting an index out of bounds error which I could reproduce in R2009a as well.
load math.mat; % MAT file attached
tomonthly(pa1)
??? Error using ==> fints.tomonthly at 175
Index exceeds matrix dimensions.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 19 Oct 2009
The issue arises because the TOMONTHLY function in the Financial Toolbox 3.3 (R2007b) is not designed to work with cell arrays. It expects a double array. We are working on resolving this issue in a future release of MATLAB.
As a workaround, please make sure that you have a double array and not a cell. For the same:
1. Convert the fints object to time series with doubles rather than with 1 x 1 cells that contain doubles. This works if you have the original data.
2. If you do not have the original data, the way to fix the existing result in the fints object pa1 is to do the following:
load math pa1
x = fts2mat(pa1);
x = cell2mat(x);
pa2 = fints(pa1.dates, x);
The resultant fints object pa2 contains doubles in the time series.

More Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!