[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
"aload" hacking
From: |
taltman |
Subject: |
"aload" hacking |
Date: |
Thu, 6 Nov 2003 03:09:07 +0000 (UTC) |
Hey all,
I've been trying to import a *.csv file with the "aload" function from
Kurt Hornik's "octave-ci" package, which can be found at:
ftp://ftp.ci.tuwien.ac.at/pub/octave/octave-ci.tar.gz
as per:
http://octave.sourceforge.net/index.index.html
, under "File I/O -> Import/Export".
It took me a while, but I figured out that the following recipe
worked:
octave> regexp1 = ",/,0/g' | sed -e 's/^,/0,";
octave> x = aload("C_o.csv",Inf,Inf,",",regexp1);
octave> size(x)
ans =
69 23
---
And my own visual inspection of the data shows it to be correct.
But, as you might see in my 'regexp1' string variable, I actually
'tricked' the "aload" function into doing more than a single pipe to
sed! The relevant code from aload.m, lines 75 to 77:
system (["cat ", filename, " | ", ...
"egrep -ve \'", ignore_regexp, "\' | ", ...
"sed -e 's/", NA, "/g' > ", tmpfile]);
So 'NA' accepts arbitrary strings. This might potentially be
problematic, but I thought I'd bring it to eveyone's attention, if
just for the novelty. :-)
Thanks,
~Tomer
-------------------------------------------------------------
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
-------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- "aload" hacking,
taltman <=