help-octave
[Top][All Lists]
Advanced

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

RE: How to read a mixed-type text data file?


From: Hall, Benjamin
Subject: RE: How to read a mixed-type text data file?
Date: Tue, 8 Mar 2005 09:23:29 -0500

Have you tried dlmread, csvread (same as dlmread), or textread?  The
octave-forge version of textread still needs some work to be fully
compatible with the Matlab equivalent, but if your input file is simple
enough it may work for you.  It most likely won't be lightening fast

example.csv
3, 5, hello
7, 22, there
33, -1, name
333,2,description



[a,b,c] = textread('example.csv','%f,%f,%s')

a = 
   3   7  33  333

b = 
   5  22  -1    2


c = 
{
   [1] = hello
   [2] = there
   [3] = name
   [4] = description
}


-----Original Message-----
From: Marcus Vinicius Eiffle Duarte [mailto:address@hidden
Sent: Tuesday, March 08, 2005 8:50 AM
To: address@hidden
Subject: How to read a mixed-type text data file?


Hey, folks!

I am porting some code from Matlab to Octave. In the beginning of the
main program, I need to load a database of chemical compounds, which
is stored in a CSV text file, with 3 numeric columns and 1 text
compound (the name of the compound). For several reasons, I must keep
the input in a CSV text format, and the list of compounds is
frequently updated, with the inclusion of some records per month.

I have been using a file called loadcell.m, contributed to the Matlab
Central's File Exchange. It uses C-style low level input functions to
read binary data. I adapted the code to run under Octave (tested only
under Linux - Fedora Core 3). In Matlab it is rather slow, and in
Octave it is not faster.

Does anyone have some good (fast) code to load such files? Am I
msssing some existent function (maybe in Octave-Forge)?

Thanks in advance,

Marcus Vinicius



-------------------------------------------------------------
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
-------------------------------------------------------------



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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