help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read only a certain number of lines using textread


From: Jaroslav Hajek
Subject: Re: read only a certain number of lines using textread
Date: Thu, 19 Aug 2010 10:04:43 +0200

On Thu, Aug 19, 2010 at 2:28 AM, Tim Rueth <address@hidden> wrote:
> I wish to read only a certain number of lines of a text file using
> textread().  For example, I have an input file:
>
> 1    2
> 3    4
> 5    6
> 7    8
>
> Let's say I want to read the first n rows into var1 and var2.  I would say:
>
> [var1 var2] = textread(infile, "%f %f", n);
>
> This doesn't seem to work...textread will read all of the lines into var1
> and var2, as if "n" didn't exist.  Is this a bug, or am I doing something
> wrong?  (I'm running version 3.2.3 on Vista.)
>
> Also, let's say I have a text string, "foo" at the end of the file, like so:
>
> 1    2
> 3    4
> 5    6
> 7    8
> foo
>
> If I use textread() to read the first 4 rows into var1 and var2, is there a
> way to then read "foo" into a string variable?
>
> Thanks,
>
> --Tim

textread is not part of Octave 3.2.x. Where did you get the function
from? The 3.3+ version has textread, but the feature of limiting the
number of lines is missing. If you want it (or help with doing it),
please open a feature request at the bug tracker
https://savannah.gnu.org/bugs/?group=octave

hth
-- 
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]