Index: /issm/trunk-jpl/src/modules/Kriging/Kriging.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/Kriging/Kriging.cpp	(revision 12250)
+++ /issm/trunk-jpl/src/modules/Kriging/Kriging.cpp	(revision 12251)
@@ -13,4 +13,5 @@
 	double  *y_interp     = NULL;
 	double  *predictions  = NULL;
+	double  *error        = NULL;
 	Options *options      = NULL;
 	int      N_interp,M_interp,M,N,n_obs;
@@ -20,5 +21,5 @@
 
 	/*checks on arguments on the matlab side: */
-	if (nrhs<NRHS || nlhs!=NLHS){
+	if (nrhs<NRHS || nlhs>NLHS){
 		KrigingUsage(); _error_("Kriging usage error");
 	}
@@ -33,8 +34,9 @@
 
 	/*Call x layer*/
-	Krigingx(&predictions,x,y,observations,n_obs,x_interp,y_interp,M_interp*N_interp,options);
+	Krigingx(&predictions,&error,x,y,observations,n_obs,x_interp,y_interp,M_interp*N_interp,options);
 
 	/*Generate output Matlab Structures*/
-	WriteData(PREDICTIONS,predictions,M_interp,N_interp);
+	if(nlhs>=1) WriteData(PREDICTIONS,predictions,M_interp,N_interp);
+	if(nlhs==2) WriteData(ERROR,error,M_interp,N_interp);
 
 	/*Free ressources: */
@@ -45,4 +47,5 @@
 	xfree((void**)&y_interp);
 	xfree((void**)&predictions);
+	xfree((void**)&error);
 
 	/*end module: */
Index: /issm/trunk-jpl/src/modules/Kriging/Kriging.h
===================================================================
--- /issm/trunk-jpl/src/modules/Kriging/Kriging.h	(revision 12250)
+++ /issm/trunk-jpl/src/modules/Kriging/Kriging.h	(revision 12251)
@@ -26,8 +26,9 @@
 /* serial output macros: */
 #define PREDICTIONS (mxArray**)&plhs[0]
+#define ERROR       (mxArray**)&plhs[1]
 
 /* serial arg counts: */
 #undef NLHS
-#define NLHS  1
+#define NLHS  2
 #undef NRHS
 #define NRHS  5
