read file from asci file
Tobias Schlüter
Tobias.Schlueter@physik.uni-muenchen.de
Fri Aug 10 12:54:00 GMT 2007
M. Kilani wrote:
> I have data in ascii file like this
>
> name value description
> x 2.3 var1
> y 3.1 var...
> e 2.5 ...
>
> I want to write a function that reads data and affects values to variables.
> notice that the function should guess the name of the variable, and then
> affect the value, ie. the order of the variables may change.
>
> is there a function in fortran that do this?
> is it easy to write?
Something similar can be done automatically with namelists. This would
require you to reformat your input file to follow the standard namelist
format.
Otherwise this kind of code is not hard to write in Fortran (or any
programming language for that matter). Just read the first element from
the line, then use SELECT ... CASE to decide which variable to drop the
value from the second column in.
NB this is not a forum for general programming questions.
Cheers,
- Tobi
More information about the Fortran
mailing list