Info

This question is closed. Reopen it to edit or answer.

Financial time-series seem to handle empty indexing strangely. Is this intended?

1 view (last 30 days)
I ran something similar to the following code:
fts1 = fints({'1/1/2000'; '1/2/2000'; '1/3/2000'}, [1;2;3]);
fts2 = fints({'1/1/2000'; '1/2/2000'; '1/3/2000'}, [4;5;6]);
fts1(isnan(fts2mat(fts2))) = NaN;
After this, fts1 becomes an empty matrix, which was unexpected to me. I am used to doing this sort of thing with regular vectors and matrices, and in those situations, the above code would leave fts1 unchanged. On the other hand, if fts2 has NaN values, then the above code works as expected; that is, fts1 becomes NaN wherever fts2 is. That said, the result of the above code seems inconsistent. Does anyone know why this might be the case? Thanks.
In addition, the following code also causes fts1 to become an empty matrix (which was also unexpected to me):
fts1 = fints({'1/1/2000'; '1/2/2000'; '1/3/2000'}, [1;2;3]);
fts1([]) = NaN;

Answers (0)

Community Treasure Hunt

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

Start Hunting!