[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #52892] textread incorrectly reads a text file
From: |
Pedro Pena |
Subject: |
[Octave-bug-tracker] [bug #52892] textread incorrectly reads a text file when empty lines are present |
Date: |
Sun, 14 Jan 2018 21:53:15 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0 |
URL:
<http://savannah.gnu.org/bugs/?52892>
Summary: textread incorrectly reads a text file when empty
lines are present
Project: GNU Octave
Submitted by: pedrolpena
Submitted on: Mon 15 Jan 2018 02:53:13 AM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: Pedro Pena
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.2.1
Operating System: GNU/Linux
_______________________________________________________
Details:
textread or one if its backend functions incorrectly reads a text file when
empty lines are present.
In this example I used two text files that differ only in that one has empty
lines and the other has none.
"cruise_params_no_empty_lines.cfg" and "cruise_params_with_empty_lines.cfg"
In this example
the contents of a and b are seemingly swapped and shifted but who knows what's
really going on here.
I believe I also saw this behaviour in octave 4.02.
Here is a snippet the result when the file is read containing empty lines
>>
[a,b]=textread('cruise_params_with_empty_lines.cfg','%s%s','Delimiter','=','CommentStyle','#');
>> a
a =
{
[1,1] =
[2,1] = .
[3,1] = AB1705
[4,1] =
[5,1] =
[6,1] = 2017
[7,1] = 0
[8,1] = 1
[9,1] = 0
[10,1] = psc
>> b
b =
{
[1,1] = working_directory
[2,1] = cruise_id
[3,1] = cruise_id_prefix
[4,1] = cruise_id_suffix
[5,1] = correct_year
[6,1] = use_mat_for_nav
[7,1] = make_nav
[8,1] = use_sadcp
[9,1] = print_formats
[10,1] = remove_zctd_downcast
Here is a snippet of the result when the file is read containing no empty
lines(This is what I was expecting)
>>
[a,b]=textread('cruise_params_no_empty_lines.cfg','%s%s','Delimiter','=','CommentStyle','#');
>> a
a =
{
[1,1] = working_directory
[2,1] = cruise_id
[3,1] = cruise_id_prefix
[4,1] = cruise_id_suffix
[5,1] = correct_year
[6,1] = use_mat_for_nav
[7,1] = make_nav
[8,1] = use_sadcp
[9,1] = print_formats
[10,1] = remove_zctd_downcast
>> b
b =
{
[1,1] = .
[2,1] = AB1705
[3,1] =
[4,1] =
[5,1] = 2017
[6,1] = 0
[7,1] = 1
[8,1] = 0
[9,1] = psc
[10,1] = 1
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Mon 15 Jan 2018 02:53:14 AM UTC Name: cruise_params_no_empty_lines.cfg
Size: 44KiB By: pedrolpena
<http://savannah.gnu.org/bugs/download.php?file_id=42912>
-------------------------------------------------------
Date: Mon 15 Jan 2018 02:53:14 AM UTC Name:
cruise_params_with_empty_lines.cfg Size: 44KiB By: pedrolpena
<http://savannah.gnu.org/bugs/download.php?file_id=42913>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?52892>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #52892] textread incorrectly reads a text file when empty lines are present,
Pedro Pena <=
- [Octave-bug-tracker] [bug #52892] textread incorrectly reads a text file when empty lines are present, Dan Sebald, 2018/01/15
- [Octave-bug-tracker] [bug #52892] textread incorrectly reads a text file when empty lines are present, Philip Nienhuis, 2018/01/15
- [Octave-bug-tracker] [bug #52892] textread incorrectly reads a text file when empty lines are present, Philip Nienhuis, 2018/01/15
- [Octave-bug-tracker] [bug #52892] textread incorrectly reads a text file when empty lines are present, Dan Sebald, 2018/01/16
- [Octave-bug-tracker] [bug #52892] textread incorrectly reads a text file when empty lines are present, Pedro Pena, 2018/01/16
- [Octave-bug-tracker] [bug #52892] textread incorrectly reads a text file when empty lines are present, Philip Nienhuis, 2018/01/16
- [Octave-bug-tracker] [bug #52892] textread incorrectly reads a text file when empty lines are present, Pedro Pena, 2018/01/16
- [Octave-bug-tracker] [bug #52892] textread incorrectly reads a text file when empty lines are present, Dan Sebald, 2018/01/17
- [Octave-bug-tracker] [bug #52892] textread incorrectly reads a text file when empty lines are present, Pedro Pena, 2018/01/17