Index: /issm/trunk-jpl/src/m/model/modelextract.m
===================================================================
--- /issm/trunk-jpl/src/m/model/modelextract.m	(revision 12575)
+++ /issm/trunk-jpl/src/m/model/modelextract.m	(revision 12576)
@@ -166,5 +166,5 @@
 	if size(md2.mesh.edges,2)>1, %do not use ~isnan because there are some NaNs...
 		%renumber first two columns
-		pos=find(~isnan(md2.mesh.edges(:,4)));
+		pos=find(md2.mesh.edges(:,4)~=-1);
 		md2.mesh.edges(:  ,1)=Pnode(md2.mesh.edges(:,1)); 
 		md2.mesh.edges(:  ,2)=Pnode(md2.mesh.edges(:,2)); 
@@ -173,18 +173,18 @@
 		%remove edges when the 2 vertices are not in the domain.
 		md2.mesh.edges=md2.mesh.edges(find(md2.mesh.edges(:,1) & md2.mesh.edges(:,2)),:);
-		%Replace all zeros by NaN in the last two columns;
+		%Replace all zeros by -1 in the last two columns;
 		pos=find(md2.mesh.edges(:,3)==0);
-		md2.mesh.edges(pos,3)=NaN;
+		md2.mesh.edges(pos,3)=-1;
 		pos=find(md2.mesh.edges(:,4)==0);
-		md2.mesh.edges(pos,4)=NaN;
-		%Invert NaN of the third column with last column (Also invert first two columns!!)
-		pos=find(isnan(md2.mesh.edges(:,3)));
+		md2.mesh.edges(pos,4)=-1;
+		%Invert -1 on the third column with last column (Also invert first two columns!!)
+		pos=find(md2.mesh.edges(:,3)==-1);
 		md2.mesh.edges(pos,3)=md2.mesh.edges(pos,4);
-		md2.mesh.edges(pos,4)=NaN;
+		md2.mesh.edges(pos,4)=-1;
 		values=md2.mesh.edges(pos,2);
 		md2.mesh.edges(pos,2)=md2.mesh.edges(pos,1);
 		md2.mesh.edges(pos,1)=values;
 		%Finally remove edges that do not belong to any element
-		pos=find(isnan(md2.mesh.edges(:,3)) & isnan(md2.mesh.edges(:,4)));
+		pos=find(md2.mesh.edges(:,3)==-1 & md2.mesh.edges(:,4)==-1);
 		md2.mesh.edges(pos,:)=[];
 	end
