[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
reading ascii matrix
From: |
John W. Eaton |
Subject: |
reading ascii matrix |
Date: |
Fri, 9 Feb 2001 09:53:58 -0600 |
On 9-Feb-2001, Ben Bauer <address@hidden> wrote:
| Info:
| Octave, version 2.1.9 (i686-pc-linux-gnu).
2.1.9 is a really ancient development release. You probably shouldn't
be using it.
| I have a plain ascii file of 2 columns and
| approx 2.8 million rows that I need to do some
| statistics on. In my octave script I have
|
| for i=1:p
| [a(i),b(i)]=fscanf(myfile,"%f %f","C");
| ...
Unless you allocated space for a and b outside the loop, this code
will cause the vectors a(i) and b(i) to be resized every time through
the loop, and every element must be copied each time the vectors are
resized. It will be slow and chew up a lot of memory.
Something like
load ("name-of-myfile");
would probably be a lot faster.
jwe
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------