Matlab function thaht applies ismember with flexible (reduced) memory footprint