# HG changeset patch # User Rik # Date 1402934117 25200 # Node ID 94d791a0373727c0501c87a952d144ff94b5020c # Parent 9c2ff236186465da62b95418918b4a6a90805067 Allow loading mat5 files generated from R and Python (bug #42562). * ls-mat5.cc (read_mat5_binary_element): Expand a 1-D object to a 2-D Nx1 object. Matlab always uses 2-D objects even for empty matrices (2-D 0x0). diff --git a/libinterp/corefcn/ls-mat5.cc b/libinterp/corefcn/ls-mat5.cc --- a/libinterp/corefcn/ls-mat5.cc +++ b/libinterp/corefcn/ls-mat5.cc @@ -666,7 +666,15 @@ } int ndims = dim_len / 4; - dims.resize (ndims); + if (ndims == 1) + { + // R and Python can create a 1-D object which is really an Nx1 object + dims.resize (2); + dims(1) = 1; + } + else + dims.resize (ndims); + for (int i = 0; i < ndims; i++) { int32_t n;