Path: news.mathworks.com!newsfeed-00.mathworks.com!solaris.cc.vt.edu!news.vt.edu!news.glorb.com!postnews.google.com!i12g2000prg.googlegroups.com!not-for-mail
From: Nathan <ngreco32@gmail.com>
Newsgroups: comp.lang.fortran,comp.soft-sys.matlab
Subject: Fortran formatted read problem (for matlab MEX file)
Date: Fri, 6 Nov 2009 10:55:43 -0800 (PST)
Organization: http://groups.google.com
Lines: 45
Message-ID: <7af025a1-6d40-4458-aab0-35bc43418c00@i12g2000prg.googlegroups.com>
NNTP-Posting-Host: 198.206.219.33
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1257533743 16724 127.0.0.1 (6 Nov 2009 18:55:43 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 6 Nov 2009 18:55:43 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: i12g2000prg.googlegroups.com; posting-host=198.206.219.33; 
	posting-account=_KeVcAoAAAB7j3xn35ujaQ0BoQhuzwJP
User-Agent: G2/1.0
X-HTTP-Via: 1.1 wwwproxy-son-ca-01.ca.sandia.gov:80 (squid/2.5.STABLE14)
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.4) 
	Gecko/20091016 Firefox/3.5.4,gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.lang.fortran:213332 comp.soft-sys.matlab:583079


Hi.
I don't know Fortran well enough to do file i/o, let alone formatted
file i/o.
I am trying to read data into my fortran code that is to be used for
calculations that will be returned to Matlab.
What I have tried, and what doesn't seem to work is as follows:
NFUEL is the fuel number (look at data example below. 1003 corresponds
to METHYL OLEATE)

	IF (NFUEL .GT. 1000) THEN
	OPEN(13, FILE = 'dipprig.dat', Access = 'sequential',
     +	Form = 'formatted', STATUS = 'unknown')
	OPEN(14, FILE = 'dipprld.dat', Access = 'sequential',
     +	Form = 'formatted', STATUS = 'unknown')
 20       FORMAT(I5,A33,5EN12.4)
 21	    FORMAT(I5,A33,4EN12.4)
		NF = -999
	DO WHILE (NF .NE. NFUEL .AND. NF .NE. 0) !Read IG
			READ(13,20) NF, FUELNAME,IGCOEF(1),IGCOEF(2),IGCOEF(3),
     +		IGCOEF(4),IGCOEF(5)
	ENDDO
		NF = -999
	DO WHILE (NF .NE. NFUEL .AND. NF .NE. 0) !Read LD
			READ(14,21) NF, FUELNAME,LDCOEF(1),LDCOEF(2),LDCOEF(3),
     +		LDCOEF(4)
	ENDDO
	ENDIF

Examples of the corresponding data files are as follows (the data is
contained within 1 line, for each file)
(dipprig.dat data example):
1003 	METHYL OLEATE                           3.2997E+05     9.7160E
+05     1.6456E+03     6.7448E+05     7.4800E+02

(dipprld.dat data example):
1003 	METHYL OLEATE                           2.4755E-01
2.6240E-01     7.6400E+02     3.3247E-01

The data values may contain a - in front of them, depending on the
fuel.
If there is any more information you need to help me, please ask.
I know that this doesn't work because while debugging, nothing is read
into the variables.

-Nathan