bugGNU Octave - Bugs: bug #58328, importdata detects incorrectly...

 
 

bug #58328: importdata detects incorrectly column headers

Submitter:  Fabio <efferre79>
Submitted:  Thu 07 May 2020 06:12:06 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 09 May 2020 03:00:26 AM UTC, comment #2: 

This turned out to be more involved than I thought.  Nevertheless, I did work up a solution and checked it in on the development branch here (https://hg.savannah.gnu.org/hgweb/octave/rev/01358faf49c9).

This will be a part of the 7.1 release of Octave.  But, since it is just an m-file you could download a copy from Octave's Mercurial repository and place it in your path if you need the fix sooner.


Rik <rik5>
Group administrator
Thu 07 May 2020 06:47:21 PM UTC, comment #1: 

Bringing in comments from bug #58293.


For reference, Matlab does not recognize column headers unless they use the correct delimiter

So,


HeaderB
1,2,3


results in textdata being equal to "HeaderB", no colheaders output, and data field of [1 2 3].

Only if the delimiter and the number of fields match does Matlab assign colheaders, rather than textdata.  For example,


HeaderA HeaderB HeaderC
1,2,3


doesn't produce colheaders because the delimiter isn't a ','.

Also,


HeaderA,HeaderB
1,2,3


doesn't work because the delimiter is correct, but there aren't three text elements.

Rik <rik5>
Group administrator
Thu 07 May 2020 06:12:06 PM UTC, original submission:  

Following comments from:

https://savannah.gnu.org/bugs/index.php?58293#comment6

let's assign output.colheaders only if the line before data contains data delimiters and the number of fields matches the columns of data too

Fabio <efferre79>

 

(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 rik5 (Posted a comment)
  • -email is unavailable- added by efferre79 (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-05-09 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2020-05-07 rik5 Item GroupIncorrect Result Matlab Compatibility
        StatusNone Confirmed
        Release5.2.0 dev

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code