octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #44511] [octave forge] (io) xlsread cannot rea


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #44511] [octave forge] (io) xlsread cannot read a csv file
Date: Sun, 6 Dec 2020 12:26:49 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0

Update of bug #44511 (project octave):

                  Status:               Postponed => Wont Fix               
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #16:

(revisiting)

With the following file:

a,b,c,d,e,f
11,12,13,"14",15,16
,22
31,32,"33",34
41,"42",,44,45
51,52,53


Matlab r2020b returns:

>> xlsread ('asc.csv')
ans =
    11    12    13    14    15    16
   NaN    22   NaN   NaN   NaN   NaN
    31    32    33    34   NaN   NaN
    41    42   NaN    44    45   NaN
    51    52    53   NaN   NaN   NaN
>> 


which I don't think you want to get. The values between double quotes are
supposed to be strings. csv2cell does that right.
Moreover,

>> [a, b, c] = xlsread ('asc.csv')
a =
    11    12    13    14    15    16
   NaN    22   NaN   NaN   NaN   NaN
    31    32    33    34   NaN   NaN
    41    42   NaN    44    45   NaN
    51    52    53   NaN   NaN   NaN
b =
  1×6 cell array
    {'a'}    {'b'}    {'c'}    {'d'}    {'e'}    {'f'}
c =
  6×6 cell array
    {'a'  }    {'b' }    {'c'  }    {'d'  }    {'e'  }    {'f'  }
    {[ 11]}    {[12]}    {[ 13]}    {[ 14]}    {[ 15]}    {[ 16]}
    {[NaN]}    {[22]}    {[NaN]}    {[NaN]}    {[NaN]}    {[NaN]}
    {[ 31]}    {[32]}    {[ 33]}    {[ 34]}    {[NaN]}    {[NaN]}
    {[ 41]}    {[42]}    {[NaN]}    {[ 44]}    {[ 45]}    {[NaN]}
    {[ 51]}    {[52]}    {[ 53]}    {[NaN]}    {[NaN]}    {[NaN]}


which IMO is an unusable mess. Matlab doen't separate the text and numeric
fields, it simply copies all over and you may sort out yourself if the
original field was numeric or text.

Also, Matlab reads a file like:

,,,
1,2,3,
1,2,3,4


as

>> xlsread ('test.csv')
ans =
     1     2     3   NaN
     1     2     3     4


so implicitly throws away the header lines (hmm, maybe acceptable) and the
line with empty fields (which I would like to know about explicitly).

All in all more reasons for me to not try to implement reading .csv, as making
this behavior Matlab-compatible is going to be a nightmare.

Closing report as "won't fix".


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?44511>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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