<div dir="ltr">Thank you all for the suggestions. I have it working now.<div><br></div><div>Regards,</div><div>Pranay.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 29, 2019 at 10:39 AM Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On Nov 28, 2019, at 7:07 PM, baikadi pranay <<a href="mailto:pranayreddy865@gmail.com" target="_blank">pranayreddy865@gmail.com</a>> wrote:<br>
> <br>
> Hello PETSc users, <br>
> <br>
> I have a sparse matrix built and I want to output the matrix for viewing in matlab. However i'm having difficulty outputting the matrix. I am writing my program in Fortran90 and I've included the following lines to output the matrix.<br>
> <br>
>  call PetscViewerBinaryOpen(PETSC_COMM_SELF,'matrix',FILE_MODE_WRITE,view,ierr)<br>
<br>
  Normally on would use to save the matrix and then use the scripts Patrick mentioned to read the matrix into Matlab or Python.<br>
<br>
   call MatView(matrix, view,ierr)<br>
   call PetscViewerDestroy(view,ierr)<br>
<br>
<br>
<br>
>  call PetscViewerBinaryGetDescriptor(view,fd,ierr)<br>
>  call PetscBinaryWrite(fd,ham,1,PETSC_SCALAR,PETSC_FALSE,ierr)<br>
> <br>
> These lines do create a matrix but matlab says its not a binary file. Could you please provide me some inputs on where I'm going wrong and how to proceed with this problem. I can provide any further information that you might need to help me solve this problem. <br>
> <br>
> <br>
> Thank you.<br>
> <br>
> Sincerely,<br>
> Pranay. <br>
<br>
</blockquote></div>