bugGNU Octave - Bugs: bug #38711, dlmread add extra zero line when...

 
 

bug #38711: dlmread add extra zero line when file contains "\0" at the end.

Submitted by:  Alois Schlögl <schloegl>
Submitted on:  Thu 11 Apr 2013 08:21:11 PM UTC  
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  3.6.4 Operating System:  GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Fri 01 Jul 2016 04:06:25 AM UTC, comment #10:

I don't think we need to change this. We are already more than Matlab compatible. Closing report.

Rik <rik5>
Project Administrator
Fri 01 Jul 2016 01:42:56 AM UTC, comment #9:

(Note that the line after ==> has a single space in it.)

It looks Matlab can't read files with \0 at all. That is consistent with the help, which says

It seems we are unconstrained by Matlab compatibility on this one.

Lachlan Andrew <lachlan>
Sat 24 May 2014 05:49:21 PM UTC, comment #8:

Not at all what I expected. What if the NULL character is really the last entry in the file? Can you try

with my newly uploaded tst_null2.csv?

(file #31429)

Rik <rik5>
Project Administrator
Sat 24 May 2014 05:21:04 PM UTC, comment #7:

Matlab says:

>> x = dlmread ('tst_null.csv', ',')

??? Error using ==> dlmread at 145
Mismatch between file and format string.
Trouble reading number from file (row 2, field 1) ==>

>> version


ans =

7.9.0.529 (R2009b)

>>

Michael Godfrey <godfrey>
Project Member
Sat 19 Apr 2014 01:42:20 AM UTC, comment #6:

Ping!

Michael, can you try

with the attached "tst_null.csv" and see what Matlab returns?

Rik <rik5>
Project Administrator
Mon 21 Oct 2013 04:08:04 PM UTC, comment #5:

Ping!

Michael, can you try

with the attached "tst_null.csv" and see what Matlab returns?

Rik <rik5>
Project Administrator
Thu 17 Oct 2013 09:40:19 PM UTC, comment #4:

Michael, can you try

with the attached "tst_null.csv" and see what Matlab returns?

Rik <rik5>
Project Administrator
Wed 04 Sep 2013 09:55:57 PM UTC, comment #3:

Oops. Now it is attached.

(file #29007)

Rik <rik5>
Project Administrator
Wed 04 Sep 2013 08:22:32 PM UTC, comment #2:

I've attached a file tst_null.csv that I would like someone to read in with Matlab.

Could not find the file. Did you really attach it?

Michael Godfrey <godfrey>
Project Member
Wed 04 Sep 2013 04:32:07 PM UTC, comment #1:

Do you have access to Matlab? I'm wondering how they treat null lines both within the data and at the end of the file. I've attached a file tst_null.csv that I would like someone to read in with Matlab.

Is the null line in the middle of the file transformed into "0 0 0"? There are two null lines at the end of the file. Are they both eliminated? Or is one retained as "0 0 0" and only the last line of the file eliminated if it contains '\0'.

Rik <rik5>
Project Administrator
Thu 11 Apr 2013 08:21:11 PM UTC, original submission:

Some csv files generated by some other software, contained a "\0" before the end of file. When trying to read this file, an extra row with zeros has been added to the resulting matrix.

The attached patch shows the problem in the test/assert statement, and provides a solution.

Other solutions than "if(!strlen(line.c_str()))" did not seem to be successful. line.length() is 1, and line.empty() was zero. when the line "\0" was read.

Alois Schlögl <schloegl>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #31429:  tst_null2.csv added by rik5 (14B - text/csv)
file #29007:  tst_null.csv added by rik5 (18B - text/csv)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lachlan (Updated the item)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by schloegl (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 15 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-07-01 rik5 StatusPostponed => Wont Fix
        Open/ClosedOpen => Closed
    2016-06-30 lachlan StatusPatch Submitted => Postponed
    2014-05-24 rik5 Attached File- => Added tst_null2.csv, #31429
        Summarydlmread add extra zero line when file contains "\\0" at the end. => dlmread add extra zero line when file contains "\0" at the end.
    2014-04-19 rik5 Summarydlmread add extra zero line when file contains "\\0" at the end. => dlmread add extra zero line when file contains "\0" at the end.
    2013-10-21 rik5 Summarydlmread add extra zero line when file contains "\\0" at the end. => dlmread add extra zero line when file contains "\0" at the end.
    2013-10-17 rik5 StatusNeed Info => Patch Submitted
        Summarydlmread add extra zero line when file contains "\\0" at the end. => dlmread add extra zero line when file contains "\0" at the end.
    2013-09-04 rik5 Attached File- => Added tst_null.csv, #29007
        Summarydlmread add extra zero line when file contains "\\0" at the end. => dlmread add extra zero line when file contains "\0" at the end.
    2013-09-04 rik5 Item GroupIncorrect Result => Matlab Compatibility
        StatusNone => Need Info
        Summarydlmread add extra zero line when file contains "\\0" at the end. => dlmread add extra zero line when file contains "\0" at the end.
    2013-04-11 schloegl Attached File- => Added dlmread-fix-for-0-terminated-file.patch, #27844

    Back to the top


    Powered by Savane 3.3