bugGNU Octave - Bugs: bug #40993, xlsread doesn't fall back to...

 
 

bug #40993: xlsread doesn't fall back to csvread for .CSV files

Submitter:  Gabor <gliptak>
Submitted:  Mon 23 Dec 2013 06:03:35 PM UTC
   
 
Category:  Octave Function Severity:  1 - Wish
Priority:  1 - Later Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  philipnienhuis
Originator Name:  Open/Closed:  * Closed
Release:  * 3.6.4 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 02 Jan 2014 08:13:19 PM UTC, comment #5: 

io-2.0.0 is out (for Octave > 3.7.2), it contains a fix.

Closing this bug

Philip Nienhuis <philipnienhuis>
Group Member
Mon 30 Dec 2013 10:48:18 PM UTC, comment #4: 

I've preliminary fixed this in io-1.3.6 (for Octave > 3.7.2), see patch #8099

If you have access to Octave > 3.7.2 would you please try it out w. io-1.3.6?

Philip Nienhuis <philipnienhuis>
Group Member
Fri 27 Dec 2013 04:04:49 PM UTC, comment #3: 

/from an enduser perspective I would like to have matlab code run unmodified/

Sure, but that doesn't invalidate my first remark:

/ ...use the proper tools... /

IMO that holds equally valid for Matlab code. Or would you disagree there?

I'll see what I can do for this. Ancient versions of xlsread.m (from before "real" spreadsheet support) used to fall back to csvread anyway - IOW there is a precedent.

Philip Nienhuis <philipnienhuis>
Group Member
Tue 24 Dec 2013 01:07:52 AM UTC, comment #2: 

Thank you for all the suggestions Philip. In the meantime, I figured out how to use textread() to load the CSV file (yes it was a heterogeneous file). While I understand the aversion for overhead, from an enduser perspective I would like to have matlab code run unmodified.

Gabor <gliptak>
Mon 23 Dec 2013 10:30:53 PM UTC, comment #1: 

First off, if you want to read simple file formats like .csv, just use the proper tools for it like csvread and/or dlmread. That's a lot faster anyway than invoking overly "heavy" functions as xlsread.
Or even better, use csv2cell (also in the io package), it's also a lot faster and it can even read heterogeneous .csv files (mixed text and numeric data).

If you run Octave on Windows with MS-Excel (or in any OS with Java & LibreOffice / OpenOffice.org) installed, xlsread can read any file format that is supported by Excel (LibreOffice / OOo, resp.), including .csv.

What Octave's xlsread doesn't do is fall back to csvread if no Excel (or LO/OOo) was found, indeed. I've been very reluctant to mimic this sort of Matlab code bloat in Octave's spreadsheet functions for various reasons.

BTW 1: I noted you do have the UNO interface supported (LibreOffice/OOo). It should be possible to run xlsread like:

[num, txt, raw, lims] = xlsread (<filename.csv>, 1, "", "UNO")

(and it'll give you the desired overhead ;-) )
Please check if this works OK for you.

I think (but I'm unsure) that this should have happened automatically, but failed because of this:

BTW 2: That POI interface message is a bug / red herring, please ignore. It has been fixed in io-1.2.4 IIRC

---------------
As there are very suitable alternatives/workarounds I'll provisionally lower priority/severity to "wish"; adapted title

Philip Nienhuis <philipnienhuis>
Group Member
Mon 23 Dec 2013 06:03:35 PM UTC, original submission:  

It seems that Matlab xlsread does load CVS files. Under Octave 3.6.4, I get this following trace:

Detected XLS interfaces: JXL*; UNO; (* = default interface)
error: xlsopen.m: unsupported file format for Apache POI
error: called from:
error:   /usr/share/octave/packages/io-1.2.2/xlsopen.m at line 260, column 7
error:   /usr/share/octave/packages/io-1.2.2/xlsread.m at line 187, column 6

Thanks

Gabor <gliptak>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gliptak (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-02 philipnienhuis StatusReady For Test Fixed
        Open/ClosedOpen Closed
        Operating SystemGNU/Linux Any
    2013-12-30 philipnienhuis StatusNone Ready For Test
        Assigned toNone philipnienhuis
    2013-12-23 philipnienhuis CategoryNone Octave Function
        Severity3 - Normal 1 - Wish
        Priority5 - Normal 1 - Later
        Item GroupNone Matlab Compatibility
        Summaryxlsread to support loading CVS? xlsread doesn't fall back to csvread for .CSV files

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code