Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening MATLAB Binary Files Using Fortran?

Status
Not open for further replies.

Watwood

Programmer
Aug 5, 2009
4
US
Anyone every done it? I know Fortran has it's own binary format that differs from others. Any tips on how to do this?

Thanks.
 
Do you know what the format is? Fortran's binary formats will read what ever record length is required.
 
It's a .mat file I created in MATLAB. Is that what you're asking?
 
So would you open and read it like this?:

open(unit=67, file = 'binary_file.mat', status = 'unknown', form = 'unformatted', access='direct', recl = '2')

do while (.not. EOF(67))
read(67,*) input(num_line)
enddo
 
My ghetto adobe reader won't read that .pdf you put up, i'll know more once I read that...
 
Something like this
Code:
integer*2 input(8192)
open(unit=67, file = 'binary_file.mat', status = 'old', form = 'unformatted', access='sequential', recl =2)

num_word = 1
do while (.not. EOF(67))
    read(67) input(num_word)
    num_word = num_word + 1
enddo
You can't use implied do loops - the cursor does not move along.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top