octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #45156] csvread and dlmread return errors when


From: Colin Foster
Subject: [Octave-bug-tracker] [bug #45156] csvread and dlmread return errors when reading an empty file
Date: Thu, 21 May 2015 00:14:54 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36

Follow-up Comment #2, bug #45156 (project octave):

I'm having trouble compiling (library issues... on a new computer)

Here's the fix I propose, which is kindof a hack but I don't see it causing
any issues


address@hidden:octave$ hg diff
diff -r abf85f8cbd6c libinterp/corefcn/dlmread.cc
--- a/libinterp/corefcn/dlmread.cc      Wed May 20 08:01:10 2015 -0700
+++ b/libinterp/corefcn/dlmread.cc      Wed May 20 19:12:32 2015 -0500
@@ -474,16 +474,19 @@
       if (c1 >= c)
         c1 = c - 1;
 
-      // Now take the subset of the matrix.
-      if (iscmplx)
-        cdata = cdata.extract (0, c0, r1, c1);
-      else
-        rdata = rdata.extract (0, c0, r1, c1);
+      // Now take the subset of the matrix, if we have at least one value
+      if (i > 0 || j > 0)
+      {
+        if (iscmplx)
+          cdata = cdata.extract (0, c0, r1, c1);
+        else
+          rdata = rdata.extract (0, c0, r1, c1);
 
-      if (iscmplx)
-        retval(0) = cdata;
-      else
-        retval(0) = rdata;
+        if (iscmplx)
+          retval(0) = cdata;
+        else
+          retval(0) = rdata;
+      }
     }
 
   return retval;


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?45156>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]