[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
read only a certain number of lines using textread
From: |
Tim Rueth |
Subject: |
read only a certain number of lines using textread |
Date: |
Wed, 18 Aug 2010 17:28:10 -0700 |
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:
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
- read only a certain number of lines using textread,
Tim Rueth <=