On Tuesday, March 5, 2013 11:07:08 AM UTC+13, Vegard wrote: > Hi, > > > > I am trying to intersect two arrays containing time records. The first array is a sequence with all the minutes of a year, while the second contains the times of the actual records (a few thousand). Each time record in each array is represented by a (row) date vector with information on the year, month, day, hour and minute of the record, but all seconds are set to zero. > > > > The following does what I want, but is slow: > > [~,iavec,ibvec] = intersect(year_vec(:,1:6),records_vec(:,1:6),'rows','stable'); > > > > To speed it up, I tried to convert all the date vectors to serial date numbers and use the following instead: > > [~,ia_serial,ib_serial] = intersect(year_serial(:,1),records_serial(:,1),'stable'); > > > > However, they do not produce the same indices ia_serial/iavec and ib_serial/ibvec...! The same thing happens with ismember. Is this due to limited precision of the date numbers in memory or am I missing something? > > > > All help greatly appreciated!