Mercurial > hg > octave-terminal
changeset 4369:3192d1c40195
[project @ 2003-03-18 09:13:46 by jwe]
author | jwe |
---|---|
date | Tue, 18 Mar 2003 09:13:46 +0000 |
parents | c45874c087c7 |
children | 790d6e486e22 |
files | scripts/ChangeLog scripts/general/shift.m |
diffstat | 2 files changed, 27 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2003-03-18 John W. Eaton <jwe@bevo.che.wisc.edu> + + * general/shift.m: Force empty_list_elements_ok to 1. + 2003-02-22 John W. Eaton <jwe@bevo.che.wisc.edu> * deprecated/struct_contains.m, deprecated/struct_elements.m:
--- a/scripts/general/shift.m +++ b/scripts/general/shift.m @@ -49,17 +49,29 @@ error ("shift: b must be an integer"); endif - if (b >= 0) - b = rem (b, nr); - t1 = x (nr-b+1:nr, :); - t2 = x (1:nr-b, :); - y = [t1; t2]; - elseif (b < 0) - b = rem (abs (b), nr); - t1 = x (b+1:nr, :); - t2 = x (1:b, :); - y = [t1; t2]; - endif + elo = empty_list_elements_ok; + + unwind_protect + + empty_list_elements_ok = 1; + + if (b >= 0) + b = rem (b, nr); + t1 = x (nr-b+1:nr, :); + t2 = x (1:nr-b, :); + y = [t1; t2]; + elseif (b < 0) + b = rem (abs (b), nr); + t1 = x (b+1:nr, :); + t2 = x (1:b, :); + y = [t1; t2]; + endif + + unwind_protect_cleanup + + empty_list_elements_ok = elo; + + end_unwind_protect if (nc == 0) y = reshape (y, 1, nr);