help-octave
[Top][All Lists]
Advanced

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

Re: csvread


From: Nicholas Jankowski
Subject: Re: csvread
Date: Tue, 5 Apr 2016 15:55:13 -0400

On Tue, Apr 5, 2016 at 3:13 PM, Jonathan Camilleri
<address@hidden> wrote:
> It does work but plotting graphs results in nothing that is too meaningful
> as yet.  I think I would like the addpath command to allow me to have the
> filename searched for.
>
> Environment variables in operating systems work in a similar manner, so I am
> kind of used to using path as an environment variable that is globally
> searched for.
>
> Not sure if someone can request this on the bug tracker.
>
> Jon
>
> On 5 April 2016 at 16:18, Mike Miller <address@hidden> wrote:
>>
>> On Tue, Apr 05, 2016 at 16:01:34 +0200, Jonathan Camilleri wrote:
>> > I think I am missing something as I try to read a CSV file to a matrix
>> > of
>> > some sort.
>> >
>> > >> addpath('C:\Users\slyth_000\Downloads\temp\M.Sc\data-sets\eurofxref')
>> > >> x = csvread('eurofxref.csv')
>> > error: dlmread: unable to open file 'eurofxref.csv'
>>
>> Yes, you have asked about this before (with pkg, but the same insight
>> applies to both). The addpath function does not help you in this case.
>>
>> Try either cd() to the directory where the file is or use the full file
>> name. To be clear, either of these should work:
>>
>>   cd('C:\Users\slyth_000\Downloads\temp\M.Sc\data-sets\eurofxref')
>>   x = csvread ('eurofxref.csv')
>>
>> or
>>
>>   dir = 'C:\Users\slyth_000\Downloads\temp\M.Sc\data-sets\eurofxref';
>>   x = csvread (fullfile (dir, 'eurofxref.csv'))
>>
>> --
>> mike


so I took a minute to look at what Octave does and what we think it
should do.  Octave pretty clearly states that addpath adds the folder
to the 'function search path'. so as you'd expect it  executes any
scripts put in the path. But there seems to be some inconsistency on
whether other files (such as a csv data file) would be found/used as
well. i.e., I can fopen a file in a folder that I add with addpath,
but i cannot open it with csvread (or dlmread, etc)

This does appear to be a Matlab compatibility issue. I just tested
with Matlab 2015b, and using addpath, I can run both scripts as well
as open data files in locations added with addpath.  I can open the
csv file with fopen and with csvread.

Since it does appear as a compatibility issue, I'll open a bug report
and let those more knowledgeable of the inner workings debate what it
should do and how it might be fixed.

That said, I wouldn't expect this to hit the release version any time
soon. For now you should probably use one of Mike's suggestions to
access data files.
Nick J.



reply via email to

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