# HG changeset patch # User Rik # Date 1432249077 25200 # Node ID ca2da088eada34501afcf1477f02b61687e43601 # Parent 6af35d4f1ba4c70b4c722294ec873124a3d2e9e9 Return an empty matrix, not error, from dlmread when file is empty (bug #45156). * dlmread.cc (Fdlmread): Only extract data from matrix if there is data to extract. Otherwise, return a null matrix. diff -r 6af35d4f1ba4 -r ca2da088eada libinterp/corefcn/dlmread.cc --- a/libinterp/corefcn/dlmread.cc Wed May 20 10:15:20 2015 -0600 +++ b/libinterp/corefcn/dlmread.cc Thu May 21 15:57:57 2015 -0700 @@ -474,11 +474,14 @@ 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 there are any values. + 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;