Quantcast
Channel: Recent posts
Viewing all articles
Browse latest Browse all 20

Determining file length

$
0
0

Hi everyone,

I was wondering if there was an easy way to do this. I wan't to read some data from a file, and input it into an allocatable matrix. To do this I need to know how many lines there are in the file, so that I can allocate the right size to the matrix.

For example, suppose that I have a file called data.dat which has the following data:

1 2 3
4 5 6
7 8 9

I would like to know that there are 3 lines, so that I can allocate my array appropriately. Is there an easy way to do this?

Thanks,

Alexis


Viewing all articles
Browse latest Browse all 20

Latest Images

Trending Articles



Latest Images