help-octave
[Top][All Lists]
Advanced

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

Re: CSV-Files; XLS-File


From: Philip Nienhuis
Subject: Re: CSV-Files; XLS-File
Date: Mon, 23 Aug 2010 11:56:17 -0700 (PDT)


Jose L. Contreras B. wrote:
> 
> Hi,
> 
> I've been trying to import an xls-file to octave. For that I saved as a
> csv-file and I used csvread or csvwrite but I couldn't import. Can you
> sent me an example to do it well? What kind of characteristics must have
> the csv-file?, for example tab delimieter, space delimeter, etc. Thanks
> 
> pd. I'm a linux user by the way.
> 

If you have the java package and a recent io package from
octave.sourceforge.net, you can read and write .xls files directly using
a.o. xlsread and xlswrite. No need then to fiddle about by writing each
sheet as a separate .csv file. There is also .ods support (OpenOffice.org
Calc).
One restriction is that your spreadsheet files shouldn't be too big.  Read
about "java.opts" if you hit java memory limits. The absolute limit is in
the order of 4-5 . 10^5 spreadsheet cells for the entire spreadsheet.

Assuming you have a mainstream linux distribution installed:
Depending on your linux distro and the software packages you selected (incl.
octave), you might already have the java package installed + probably an
older io package. Most recent linux distros have a little bit older
"monolithic" octave-forge package where java-1.2.5 package is included -
that will work OK.

As for io package, a quick and dirty but nonetheless robust and fast
procedure is:
- download the io-package from octave-sourceforge.net (hopefully the
io-1.0.13 package I uploaded recently has been made available by the site
maintainer. If not, io-1.0.12 or io-1.0.11 will also work OK)
- unpack it somewhere (it's a plain .tar.gz file)
- as root, copy all m-files in the unpacked ./io-<version>/inst subdirectory
into /usr/share/octave/packages/io<some_version> (overwriting an existing
xlsread.m of more than 2 yrs old)
- download the needed java classes (see the read-xls.html documentation file
in the unpacked io-<version>/doc subdir) , put them in e.g., /usr/lib or
/usr/local/lib or so and add them to the javaclasspath using
     javaaddpath ('/fully/qualified/pathname/to/java/<classfile>.jar')
For reading .xls, just jxl.jar (JExcelAPI) will do as long as you don't have
Excel2007 files (OOXML)

Philip

-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/CSV-Files-XLS-File-tp2334452p2335644.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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