# 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 --git a/libinterp/corefcn/dlmread.cc b/libinterp/corefcn/dlmread.cc --- a/libinterp/corefcn/dlmread.cc +++ b/libinterp/corefcn/dlmread.cc @@ -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;