reading matlab binary files

Barry Smith bsmith at mcs.anl.gov
Fri Feb 20 11:27:18 CST 2009


   Irfan,

    Make sure you use the absolutely latest PETSc patches version.  
There were some problems that we just recently fixed.
If that does not solve the problem send the binary file to petsc-maint at mcs.anl.gov

    Barry

On Feb 20, 2009, at 10:51 AM, Khan, Irfan wrote:

> Hi
>
> In an earlier email to the group Barry mentioned that if the matrix  
> sizes are large, the output should be done in binary format and bin/ 
> matlab/PetscBinaryRead.m should be used to read the matrix into  
> matlab.
>
> I have output the matrix in the following manner.
>
>       ierr   =  PetscViewerBinaryOpen(PETSC_COMM_WORLD, fname,  
> FILE_MODE_WRITE, &viewer);
>       ierr   =   
> PetscObjectSetName((PetscObject)obj.Amat,"Stiffness_matrix");
>       ierr   =  MatView(obj.Amat,viewer);
>
> I don't get any error messages during execution. However, when I  
> have not been successful reading the matrix into matlab. Presently I  
> get the following error messages.
>
>
>
> ??? Error using ==> fread
> Invalid file identifier.  Use fopen to generate a valid file  
> identifier.
>
> Error in ==> PetscOpenFile.read at 5
> d = fread(freader.fd,count,datatype);
>
> Error in ==> PetscBinaryRead at 49
>  header = read(fd,1,'int32');
>
>
> Any suggestions to solve the problem?
>
> Thanks
> Irfan



More information about the petsc-users mailing list