Mercurial > hg > octave-avbm
changeset 1275:d607adf5af66
[project @ 1995-04-21 19:59:03 by jwe]
author | jwe |
---|---|
date | Fri, 21 Apr 1995 19:59:03 +0000 |
parents | 305162358727 |
children | cbdf7db98554 |
files | src/load-save.cc |
diffstat | 1 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -1293,15 +1293,22 @@ { int nr = 0, nc = 0; - if (extract_keyword (is, "rows", nr) && nr > 0 - && extract_keyword (is, "columns", nc) && nc > 0) + if (extract_keyword (is, "rows", nr) && nr >= 0 + && extract_keyword (is, "columns", nc) && nc >= 0) { - Matrix tmp (nr, nc); - is >> tmp; - if (is) - tc = tmp; + if (nr > 0 && nc > 0) + { + Matrix tmp (nr, nc); + is >> tmp; + if (is) + tc = tmp; + else + error ("load: failed to load matrix constant"); + } + else if (nr == 0 || nc == 0) + tc = Matrix (nr, nc); else - error ("load: failed to load matrix constant"); + panic_impossible (); } else error ("load: failed to extract number of rows and columns");