intersect function for old Matlab versions