1 function fid=ftopen(file)
2 % open fortran unformatted file with proper endian
3 endian(1).par='native';
4 endian(2).par='ieee-le';
5 endian(3).par='ieee-be';
6 endian(4).par='ieee-be.l64';
7 endian(5).par='ieee-be.l64';
9 for i=1:length(endian);
10 fid=fopen(file,'r',endian(i).par);
12 fprintf('cannot open file %s\n',file),
16 % fprintf('first word in %s mode is %i\n',endian(i).par,j)
24 fprintf(1,'cannot find mode to open file %s\n',file),
28 fid=fopen(file,'r',mode);
29 fprintf('FORTRAN file %s mode %s\n',file,mode);