in my fortran code i am outputting the results into a binary file.
open(21,file=anum('press',itime),form=format_mode)
write(21) rtime,itime,dt,nx0,ny0,nz,deltax,deltay,rlenz
write(21) rw
close(21)
the above is the fortran code that writes and saves the file.
i now want to open and analyse it in matlab:
fid = open('press.420000');
A = fread(fid);
close(fid);
this however, only creates a 1d array which i am guessing includes all the header information too.
i want Matlab to read the header values but not include them into the final array. i intend to reshape the array in to a 3d array as the data is from a cfd simulation which has a grid of 256x512x390 = 51,180,80
the Matlab code gives me a 1d array of 411,343,976, which cannot be correct.
thus i am struggling how to read the binary file. I need some guidance on how i should code a Matlab script to read the binary file
format_mode? That is a very important information. - Vladimir Fformat_modemust beunformattedelse thewritewould fail. My advice is to useaccess=streaminstead of coaxing matlab to read the arcane fortran default sequential access format. The other concern is of course the variable types need to be the same in both programs. - agentp