[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to know number of lines from input file
From: |
Søren Hauberg |
Subject: |
Re: how to know number of lines from input file |
Date: |
Wed, 07 Oct 2009 07:52:29 +0200 |
ons, 07 10 2009 kl. 11:56 +0900, skrev febty febriani:
> If I have command like below :
>
> fh=fopen("$dir/data-1day-1Hz/result-${year}${month}${num}.dat","r");
> y=fscanf(fh,"%lf");
>
> are there any tricks to know number of lines from the input file?
If your file only contains numbers, then you can just use the 'load'
command, which will give you a neatly formated matrix.
If you know the number of numbers in each line, then you can also do
something like
y = fscanf (fh, "%lf", [N, Inf])
where N is the number of numbers per line.
Søren