[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #59848] dlmread returns wrong values when skip
From: |
Hartmut |
Subject: |
[Octave-bug-tracker] [bug #59848] dlmread returns wrong values when skipping non-numerical columns |
Date: |
Sat, 9 Jan 2021 09:54:53 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0 |
URL:
<https://savannah.gnu.org/bugs/?59848>
Summary: dlmread returns wrong values when skipping
non-numerical columns
Project: GNU Octave
Submitted by: hardy
Submitted on: Sat 09 Jan 2021 02:54:51 PM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Inaccurate Result
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Release: 6.1.0
Discussion Lock: Any
Operating System: Any
_______________________________________________________
Details:
Here is how to reproduce this behavior of dlmread. I used those two demo data
files:
dataA.csv:
2020-12-21 00:00:00,2020-12-21 01:00:00,9.4,5.8,78
2020-12-21 01:00:00,2020-12-21 02:00:00,8.5,5.4,81
2020-12-21 02:00:00,2020-12-21 03:00:00,6.4,4.9,90
dataB.csv:
a,b,9.4,5.8,78
c,d,8.5,5.4,81
e,f,6.4,4.9,90
and the following small m-script:
clear
myfile = "dataA.csv";
%myfile = "dataB.csv";
data1 = dlmread(myfile,',',1,2) % skip first row and two first columns
data2 = dlmread(myfile,',',0,2) % only skip to first columns
With dataA.csv I get
as result in data1
* in Matlab: the expected numerical result (2x3 matrix)
* in Octave: an empty matrix.
and as result in data2
* in Matlab: the expected numerical result (3x3 matrix)
* in Octave: an 1x11 complex array of nonsense numbers
With dataB.csv I get
as result in data1
* in Octave: an empty matrix
as result in data2
* in Octave: a 1x11 array of the correct numbers plus some additional zeros
(I have not testes the Matlab result here)
I know that dlmread can only return fully numeric results. But in this case
the expected result is fully numeric, because just the two first columns, that
dlmread should skip, contain non-numeric values. That's why I think dlmread
should be able to properly function in this case (and in Matlab this does work
fine).
I also know that I could work around this with textread or other data import
functions. But it feels wrong that in this quite simple case (just numeric
numbers to read) our dlmread function (and therefore probably also csvread)
fails. (And the "next generation" data import function matrixread is not yet
implemented in Octave.)
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59848>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #59848] dlmread returns wrong values when skipping non-numerical columns,
Hartmut <=
- [Octave-bug-tracker] [bug #59848] dlmread returns wrong values when skipping non-numerical columns, Philip Nienhuis, 2021/01/09
- [Octave-bug-tracker] [bug #59848] dlmread returns wrong values when skipping non-numerical columns, Dmitri A. Sergatskov, 2021/01/09
- [Octave-bug-tracker] [bug #59848] dlmread returns wrong values when skipping non-numerical columns, Hartmut, 2021/01/09
- [Octave-bug-tracker] [bug #59848] dlmread returns wrong values when skipping non-numerical columns, Doug Stewart, 2021/01/09
- [Octave-bug-tracker] [bug #59848] dlmread returns wrong values when skipping non-numerical columns, Rik, 2021/01/12
- [Octave-bug-tracker] [bug #59848] dlmread returns wrong values when skipping non-numerical columns, Hartmut, 2021/01/12
- [Octave-bug-tracker] [bug #59848] dlmread returns wrong values when skipping non-numerical columns, Rik, 2021/01/12
- [Octave-bug-tracker] [bug #59848] dlmread returns wrong values when skipping non-numerical columns, Hartmut, 2021/01/13
- [Octave-bug-tracker] [bug #59848] dlmread returns wrong values when skipping non-numerical columns, Rik, 2021/01/13
- [Octave-bug-tracker] [bug #59848] dlmread returns wrong values when skipping non-numerical columns, Hartmut, 2021/01/13