Index: /issm/trunk-jpl/src/c/io/Matlab/FetchMatlabData.cpp
===================================================================
--- /issm/trunk-jpl/src/c/io/Matlab/FetchMatlabData.cpp	(revision 11674)
+++ /issm/trunk-jpl/src/c/io/Matlab/FetchMatlabData.cpp	(revision 11675)
@@ -60,6 +60,5 @@
 		outmatrix=NULL;
 	}
-	else if (mxIsClass(dataref,"double") ){
-
+	else if(mxIsClass(dataref,"double") || mxIsClass(dataref,"single")){
 		/*Check dataref is not pointing to NaN: */
 		if ( mxIsNaN(*(mxGetPr(dataref))) && (mxGetM(dataref)==1) && (mxGetN(dataref)==1) ){
@@ -69,5 +68,4 @@
 		}
 		else{
-
 			/*Convert matlab matrix to double* matrix: */
 			MatlabMatrixToDoubleMatrix(&outmatrix,&outmatrix_rows,&outmatrix_cols,dataref);
Index: /issm/trunk-jpl/src/c/toolkits/petsc/patches/MatlabMatrixToDoubleMatrix.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/patches/MatlabMatrixToDoubleMatrix.cpp	(revision 11674)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/patches/MatlabMatrixToDoubleMatrix.cpp	(revision 11675)
@@ -25,8 +25,7 @@
 int MatlabMatrixToDoubleMatrix(double** pmatrix,int* pmatrix_rows,int* pmatrix_cols,const mxArray* mxmatrix){
 
-	int rows, cols;
-	double* mxmatrix_ptr=NULL;
-	int ierr;
-	int i,j;
+	int     i,j,count,rows,cols;
+	double *pmxdoublematrix = NULL;
+	float  *pmxsinglematrix = NULL;
 
 	/*output: */
@@ -36,8 +35,4 @@
 	mwIndex*    ir=NULL;
 	mwIndex*    jc=NULL;
-	double* pr=NULL;
-	int     count;
-	int     nnz;
-	int     nz;
 
 	/*Ok, first check if we are dealing with a sparse or full matrix: */
@@ -45,14 +40,10 @@
 
 		/*Dealing with sparse matrix: recover size first: */
-		mxmatrix_ptr=(double*)mxGetPr(mxmatrix);
+		pmxdoublematrix=(double*)mxGetPr(mxmatrix);
 		rows=mxGetM(mxmatrix);
 		cols=mxGetN(mxmatrix);
-		nnz=mxGetNzmax(mxmatrix);
-		nz=(int)((double)nnz/(double)rows);
-
 		matrix=(double*)xcalloc(rows*cols,sizeof(double));
 
 		/*Now, get ir,jc and pr: */
-		pr=mxGetPr(mxmatrix);
 		ir=mxGetIr(mxmatrix);
 		jc=mxGetJc(mxmatrix);
@@ -62,5 +53,5 @@
 		for(i=0;i<cols;i++){
 			for(j=0;j<(jc[i+1]-jc[i]);j++){
-				*(matrix+rows*ir[count]+i)=pr[count];
+				matrix[rows*ir[count]+i]=pmxdoublematrix[count];
 				count++;
 			}
@@ -68,12 +59,9 @@
 
 	}
-	else{
-
-
+	else if(mxIsClass(mxmatrix,"double")){
 		/*Dealing with dense matrix: recover pointer and size: */
-		mxmatrix_ptr=(double*)mxGetPr(mxmatrix);
+		pmxdoublematrix=(double*)mxGetPr(mxmatrix);
 		rows=mxGetM(mxmatrix);
 		cols=mxGetN(mxmatrix);
-
 		
 		/*Create serial matrix: */
@@ -82,8 +70,25 @@
 		for(i=0;i<rows;i++){
 			for(j=0;j<cols;j++){
-				*(matrix+cols*i+j)=*(mxmatrix_ptr+rows*j+i);
+				matrix[cols*i+j]=(double)pmxdoublematrix[rows*j+i];
 			}
 		}
-		
+	}
+	else if(mxIsClass(mxmatrix,"single")){
+		/*Dealing with dense matrix: recover pointer and size: */
+		pmxsinglematrix=(float*)mxGetPr(mxmatrix);
+		rows=mxGetM(mxmatrix);
+		cols=mxGetN(mxmatrix);
+
+		/*Create serial matrix: */
+		matrix=(double*)xcalloc(rows*cols,sizeof(double));
+
+		for(i=0;i<rows;i++){
+			for(j=0;j<cols;j++){
+				matrix[cols*i+j]=(double)pmxsinglematrix[rows*j+i];
+			}
+		}
+	}
+	else{
+		_error_("Matlab matrix type Not implemented yet");
 	}
 
