YI(:)],[0,direction-1]);
0092         plot(dataI(:,1),dataI(:,2),<span class="string">'yx'</span>);
0093         idx=nan*ones(1,length(dataI));
0094         <span class="keyword">for</span> ii=1:length(dataI)
0095             [idx(ii),~] = find_nearest_pt(dataI(ii,1),dataI(ii,2),Mobj);
0096         <span class="keyword">end</span>;
0097         <span class="comment">% find if there are duplicates in idx</span>
0098         [~,igood]=unique(idx);
0099         <span class="keyword">if</span> length(igood)~=le