help-octave
[Top][All Lists]
Advanced

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

Re: reading xls file


From: John W. Eaton
Subject: Re: reading xls file
Date: Fri, 31 Aug 2007 17:34:54 -0400

On 31-Aug-2007, Antonio Palestrini wrote:

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

The help for the current version of dlmread says:

  x = dlmread (filename, sep, row)
     Read the matrix x from a file, with columns separated by the
     character sep (default is ",").  NaN values are written as nan.
     The number of rows to skip before reading data is row (default is 0).

so instead of editing the file, I think you can just use

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

jwe


reply via email to

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