Reading fortran unformatted binary file into matlab
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
ARF
le 21 Mar 2015
Réponse apportée : Image Analyst
le 21 Mar 2015
I would like to read an unformatted binary file written with FORTRAN into MATLAB. The FORTRAN code I used to write the data in binary format is the following:
!!$!%%%%%%%%OUTPUT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
do k=1,nt
write(strn4,'(I4.4)')k
nameout1 = trim(directory)//'fileuv-U'//strn4//'.dat'
iunitout = 74
open(iunitout,file=nameout1,form='unformatted')
do j=1,ny
do i=1,nx
write(iunitout) u(i,j,k),v(i,j,k)
enddo
enddo
close(iunitout)
enddo
I would like to read the resulting binary file into MATLAB. Thank you very much for your help.
0 commentaires
Réponse acceptée
Image Analyst
le 21 Mar 2015
Try fopen(), fread(), and fclose(). Examples are in the help.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Fortran with MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!