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 Apr 11 20:21:11 2013  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: Wont FixAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.6.4Operating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Fri Jul 1 04:06:25 2016, 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 Jul 1 01:42:56 2016, 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>
Project Member
Sat May 24 17:49:21 2014, 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 May 24 17:21:04 2014, 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>
Sat Apr 19 01:42:20 2014, comment #6:

Ping!

Michael, can you try

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

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

Ping!

Michael, can you try

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

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

Michael, can you try

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

Rik <rik5>
Project Administrator
Wed Sep 4 21:55:57 2013, comment #3:

Oops. Now it is attached.

(file #29007)

Rik <rik5>
Project Administrator
Wed Sep 4 20:22:32 2013, 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>
Wed Sep 4 16:32:07 2013, 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 Apr 11 20:21:11 2013, 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 File(s):
   
   
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
  • -unavailable- added by lachlan (Updated the item)
  • -unavailable- added by godfrey (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by schloegl (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 15 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri Jul 1 04:06:25 2016rik5StatusPostponed=>Wont Fix
      Open/ClosedOpen=>Closed
    Thu Jun 30 13:21:37 2016lachlanStatusPatch Submitted=>Postponed
    Sat May 24 17:49:21 2014rik5Attached 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.
    Sat Apr 19 01:42:20 2014rik5Summarydlmread add extra zero line when file contains "\\0" at the end. =>dlmread add extra zero line when file contains "\0" at the end.
    Mon Oct 21 16:08:04 2013rik5Summarydlmread add extra zero line when file contains "\\0" at the end. =>dlmread add extra zero line when file contains "\0" at the end.
    Thu Oct 17 21:40:19 2013rik5StatusNeed 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.
    Wed Sep 4 21:55:57 2013rik5Attached 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.
    Wed Sep 4 16:32:07 2013rik5Item 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.
    Thu Apr 11 20:21:11 2013schloeglAttached File-=>Added dlmread-fix-for-0-terminated-file.patch, #27844

    Back to the top


    Powered by Savane 3.1-cleanup