help-octave
[Top][All Lists]
Advanced

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

Re: reading xls file


From: Antonio Palestrini
Subject: Re: reading xls file
Date: Fri, 31 Aug 2007 19:49:27 +0200

>   I have installed Octave 2.9.13 for windows. I put a file.xls
> intitled "kir" in (c:/programfiles/octave). this file contains two
> columns.the first headed with y, the other with x. I want to read
> kir.xls from "Octave propmt".I have written this line: fid=fopen
> ("kir.xls,"r") The problem, I obtained always a strictly positif
> integer but I can't read the two columns x and y. What can I do?
> Many thanks in advance

> Normally, the xls file is a binary Excel spreadsheet file, and contains
> proprietary Microsoft encoding of your data. You have to save the file
> in an ASCII format, for instance as a CSV file.

This is an example of what to do ... it may
seem not very elegant, but it works.

1) As said by Przemek, save your excel file, let's say data.xls file as csv format (data.csv)

2) open the file data.csv that in my example has 2 columns and 3 rows.
It looks like

---- data.csv ---
x;y
1;2
2;4
3;6
--------------------------

and delete the first row with labels, so remainin with

---- data.csv ---
1;2
2;4
3;6
--------------------------

3) in octave write 

m = dlmread("data.csv",";");

(there is also the function "csvread" that calls "dlmread")
and you get the matrix of data stored in m.


hope it may be useful
antonio

reply via email to

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