Help read the file
Help read the file
(OP)
Dear all
I need to read the data file to the variables: Date, time, Value1,Value2,Value3. The variables are array with dimension n arbitrary. Inside the file likes:
06/05/2008 21:00:10.000 1.0123980E+0001 5.0372083E-0004 2.6052687E+0001
06/05/2008 21:30:10.000 1.0127100E+0001 8.8555174E-0004 2.6146746E+0001
06/05/2008 22:00:10.000 1.0129192E+0001 8.2108111E-0004 2.6269987E+0001
06/05/2008 22:30:10.000 1.0132229E+0001 7.4600358E-0004 2.6247709E+0001
...
...
Thanks alot in advance
ninhchubeach
I need to read the data file to the variables: Date, time, Value1,Value2,Value3. The variables are array with dimension n arbitrary. Inside the file likes:
06/05/2008 21:00:10.000 1.0123980E+0001 5.0372083E-0004 2.6052687E+0001
06/05/2008 21:30:10.000 1.0127100E+0001 8.8555174E-0004 2.6146746E+0001
06/05/2008 22:00:10.000 1.0129192E+0001 8.2108111E-0004 2.6269987E+0001
06/05/2008 22:30:10.000 1.0132229E+0001 7.4600358E-0004 2.6247709E+0001
...
...
Thanks alot in advance
ninhchubeach





RE: Help read the file
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: Help read the file
Date and time are not standard items in Fortran (and most computing languages). Some places store the date as days since 1st Jan 1970. Some store the time as seconds since midnight. Some store the date and time together, the time being a fraction of a day.
RE: Help read the file
I wrote some code to convert the data and time format to the serial number (since 1st Jan. 1900) so the store data and time format is OK.
My problem is I can not read the other values at the next column after time column (value1, value2, value3). I'd like to use those values for my calculation.
Please help me how to read them?
Thank you in advance and sorry for my response to late!
RE: Help read the file
CODE
1000 format (I2,1X,I2,1X,I4, 1X,I2,1X,I2,1X, F6.3, 3G17.8)
RE: Help read the file
I will try reading that file in you ways!
RE: Help read the file
Dear All,
I have a problem concerning reading date and time from the data file in fortran. The data file have 10 'column field'. I'd like to read the data file to variables: Dateset, Date, Time, realdata(1:7). Because of slash (/) character of Date field, which fortran recognize as: 'go to the next line' so I couldn't read the next data after '/' character. My data file like:
1 16/05/2008 11:11:35 10.385770 106.866953 0.00 29.61 0.02 0.02 70.00 1173.26 0.02
2 16/05/2008 11:11:35 10.389513 106.867763 0.00 29.59 0.02 0.01 70.00 1173.10 0.03
3 16/05/2008 11:11:35 10.389513 106.867763 0.00 29.57 0.02 0.01 70.00 1173.10 0.03
4 16/05/2008 11:11:36 10.389513 106.867763 -0.02 29.58 0.02 0.01 70.00 1173.26 0.03
5 16/05/2008 11:11:36 10.389513 106.867763 0.00 29.58 0.02 0.01 70.00 1173.10 0.04
6 16/05/2008 11:11:36 10.389513 106.867763 -0.01 29.60 0.02 0.01 70.00 1172.95 0.04
...
...
I would be appreciated if someone can help me to find the way to read such data.
Best regards,
Ninhchubeach
RE: Help read the file
RE: Help read the file
I can store the date and time as the character or whatever. If we can read the data of this file and if data and time are the variables of character(10) and character(8) or the variables of integer, I can convert data and time to Time Series (the number since Jan., 1st 1900).
So my problem is how to read the data inside the file.
Pleas help me to do this
Thank you very much
Regards
Ninhchubeach
RE: Help read the file
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: Help read the file