[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #56047] dlmread with NaN as range parameter re
From: |
Mike Miller |
Subject: |
[Octave-bug-tracker] [bug #56047] dlmread with NaN as range parameter returns an empty array |
Date: |
Mon, 1 Apr 2019 12:26:42 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36 |
Update of bug #56047 (project octave):
Severity: 3 - Normal => 2 - Minor
Item Group: Other => Incorrect Result
Status: None => Need Info
Summary: dlmread() - NaN / different file length => dlmread
with NaN as range parameter returns an empty array
_______________________________________________________
Follow-up Comment #1:
Thank you for your report. I don't know if this is a bug or not.
Since you didn't explicitly show the difference, in Octave 4.2.1 and earlier I
see
>> data = dlmread ("foo.txt", ",")
data =
0.7246355 0.9038270 0.2715474 0.0537131 0.0062652 0.6589647
0.5013773 0.7448110 0.9847691 0.6116570 0.3918950 0.8894601
0.1572770 0.2567405 0.1690453 0.5567996 0.0110273 0.2038035
0.1387583 0.5858817 0.5020694 0.4169618 0.8551791 0.0294324
0.5909749 0.9383733 0.8427086 0.4166940 0.3021889 0.8196946
0.8825450 0.8234280 0.3286623 0.2107583 0.9080787 0.1634514
>> size (data)
ans =
6 6
>> data = dlmread ("foo.txt", ",", [1, 1, NaN, 2])
data =
0.74481 0.98477
0.25674 0.16905
0.58588 0.50207
0.93837 0.84271
0.82343 0.32866
That is, NaN is a synonym for the last row or column.
In Octave 4.2.2
>> data = dlmread ("foo.txt", ",", [1, 1, NaN, 2])
data = [](0x0)
But, in Octave 4.2.2 and current versions of Octave (highly recommended to
upgrade), you can use Inf instead of NaN to get the behavior that you want.
Using a parameter of Inf makes more intuitive sense to me than NaN.
What does Matlab do with a range parameter of NaN?
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?56047>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/