Index: /issm/trunk/src/mex/ContourToNodes/ContourToNodes.cpp
===================================================================
--- /issm/trunk/src/mex/ContourToNodes/ContourToNodes.cpp	(revision 5029)
+++ /issm/trunk/src/mex/ContourToNodes/ContourToNodes.cpp	(revision 5030)
@@ -50,7 +50,5 @@
 	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&ContourToNodesUsage);
 
-	/*First, call expread on filename to build a contour array in the matlab workspace: */
-	mexCallMATLAB( 1, &matlabstructure, 1, (mxArray**)&FILENAME, "expread");
-
+	
 	/*Fetch inputs: */
 	FetchData(&x,&nods,NULL,XHANDLE);
@@ -59,4 +57,14 @@
 
 	//Fetch contours
+
+	if(mxIsChar(FILENAME)){
+		/*Call expread on filename to build a contour array in the matlab workspace: */
+		mexCallMATLAB( 1, &matlabstructure, 1, (mxArray**)&FILENAME, "expread");
+	}
+	else{
+		/*FILENAME is actually a structure, coming directly from expread: */
+		matlabstructure=(mxArray*)FILENAME;
+	}
+
 	numcontours=mxGetNumberOfElements(matlabstructure);
 	contours=(Contour**)xmalloc(numcontours*sizeof(Contour*));
@@ -99,5 +107,5 @@
 	printf("   where:\n");
 	printf("      x,y: list of nodes.\n");
-	printf("      contourname: name of .exp file containing the contours.\n");
+	printf("      contourname: name of .exp file containing the contours, or resulting structure from call to expread.\n");
 	printf("      interptype: string definining type of interpolation ('element', or 'node').\n");
 	printf("      edgevalue: integer (0, 1 or 2) defining the value associated to the nodes on the edges of the polygons.\n");
