help-octave
[Top][All Lists]
Advanced

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

RE: Read CSV file on Windows 7, 64 bit


From: Allen.Windhorn
Subject: RE: Read CSV file on Windows 7, 64 bit
Date: Tue, 14 Feb 2012 12:22:59 -0600

Aradwan,

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of aradwan

> I have a CSV file with one column, 8760 rows. I need to load
> this file to octave. I tried a lot with csvread but I couldn't
> load the file. I don't know where should I put the original
> csv file to be read.

I have the same setup.  You can put the file in a directory in
your path (type "path" at the prompt to see what is in it).
[Caveat: this didn't seem to work for me.  Maybe only for
execution of a file.] Or you can give a full path to the file.
Or you can change directory and then read the file.

Here is what I did:

octave-3.2.4.exe:6> addpath c:/users/windhoal/Documents/m
octave-3.2.4.exe:7> savepath
warning: savepath: current path saved to ~\.octaverc
octave-3.2.4.exe:8> B = csvread("csvfile.csv")
error: dlmread: unable to open file `csvfile.csv'
error: called from:
error:   C:\Octave\...\csvread.m at line 27, column 5
octave-3.2.4.exe:9> help cd
`cd' is a built-in function

 -- Command: cd dir
 -- Command: chdir dir
     Change the current working directory to DIR.  If DIR is omitted,
     the current directory is changed to the user's home directory.
     For example,

          cd ~/octave

     Changes the current working directory to `~/octave'.  If the
     directory does not exist, an error message is printed and the
     working directory is not changed.

     See also: mkdir, rmdir, dir ...

octave-3.2.4.exe:10> cd c:/users/windhoal/Documents/m
octave-3.2.4.exe:11> B = csvread("csvfile.csv")
B =

  1.2340e+002  1.1600e+001
  9.5992e+003  5.5830e-001
  7.6500e+000  2.1990e+001

octave-3.2.4.exe:12> C =
csvread("c:/users/windhoal/Documents/m/csvfile.csv")
C =

  1.2340e+002  1.1600e+001
  9.5992e+003  5.5830e-001
  7.6500e+000  2.1990e+001

Note that the file path is written with forward slashes.  If you
use backslashes you may have to double them.

Regards,
Allen


reply via email to

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