Consider the following example:
time = datenum('2010-03-03 00:00','yyyy-mm-dd HH:MM'):60/(60*24):...
datenum('2010-07-31 23:00','yyyy-mm-dd HH:MM');
Jday = datenum('2010-01-01 00:00','yyyy-mm-dd HH:MM'):60/(60*24):...
datenum('2010-12-31 23:00','yyyy-mm-dd HH:MM');
idx = intersect(time,Jday);
Why isn't idx the same size as time? I would have thought that these should be identical in length seeing as time is just a portion of Jday. Any ideas?
You create vectors using the colon operator, with a non-integer interval. Since intersect
does element comparisons, you're bound to have inaccuracies due to their floating-point representation, and in this case I suspect that it's the issue. If you want to verify that, I suggest that you use ismember
to identify which members are not equal (but supposed to be).