Newbie on the lose.. How to add an unknown length dataset to an array
- From: "Mdj" <mdj@xxxxxxxxxxxx>
- Date: Mon, 13 Nov 2006 02:01:01 +0100
Hi
I learning fortran at the moment as part of my physics study, and I love the
language so far, anyway...
I have a small project where I need to analyze some data in the form of 1-D
unformated text, I know how to do that, and for a fixed size dataset I
wouldn't have a problem, but I want to do unknown length datasets (otherwise
I don't really have anything useful) So I came up with a simple rotating
allocatable array scheme, something like:
read a line to array "a"
now do array "b" = "a"
deallocate a
allocate a(size(b)+1)
a = b
deallocate b
and so on...
Quite simple and it works.. but is it effective? can some of you magicians
share with me how to do it "right"? would it be better to pase the text file
first to find the length of it? (the data is not of equal length so I can't
use the file-size directly)
Any feedback is much appreciated :)
Morten
http://mdj.dk
.
- Follow-Ups:
- Re: Newbie on the lose.. How to add an unknown length dataset to an array
- From: Louis Krupp
- Re: Newbie on the lose.. How to add an unknown length dataset to an array
- From: Mark Morss
- Re: Newbie on the lose.. How to add an unknown length dataset to an array
- From: Arno
- RE: Newbie on the lose.. How to add an unknown length dataset to an array
- From: meek
- Re: Newbie on the lose.. How to add an unknown length dataset to an array
- Prev by Date: Re: J3's workings
- Next by Date: puzzling syntax
- Previous by thread: Big Optical Design Program in Fortran
- Next by thread: RE: Newbie on the lose.. How to add an unknown length dataset to an array
- Index(es):