Mercurial > octave
diff scripts/general/shift.m @ 4369:3192d1c40195
[project @ 2003-03-18 09:13:46 by jwe]
author | jwe |
---|---|
date | Tue, 18 Mar 2003 09:13:46 +0000 |
parents | 22bd65326ec1 |
children | cef48c4b902d |
line wrap: on
line diff
--- a/scripts/general/shift.m Mon Mar 17 14:01:56 2003 +0000 +++ b/scripts/general/shift.m Tue Mar 18 09:13:46 2003 +0000 @@ -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);