Mercurial > hg > octave-terminal
changeset 9769:9a1c4fe44af8
small interp1 simplification
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 02 Nov 2009 15:17:01 +0100 |
parents | 31900e17b5f5 |
children | 1a69a9c0ee00 |
files | scripts/ChangeLog scripts/general/interp1.m |
diffstat | 2 files changed, 8 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-11-02 Jaroslav Hajek <highegg@gmail.com> + + * general/interp1.m: + 2009-11-02 Jaroslav Hajek <highegg@gmail.com> * polynomial/mkpp.m: Improve Matlab compatibility.
--- a/scripts/general/interp1.m +++ b/scripts/general/interp1.m @@ -127,13 +127,15 @@ ## reshape matrices for convenience x = x(:); nx = rows (x); + szx = size (xi); if (isvector (y)) y = y(:); + elseif (isvector (xi)) + szx = length (xi); endif szy = size (y); y = y(:,:); [ny, nc] = size (y); - szx = size (xi); xi = xi(:); ## determine sizes @@ -293,15 +295,7 @@ yi(outliers, :) = extrap; endif - if (! isvector (y) && length (szx) == 2 && (szx(1) == 1 || szx(2) == 1)) - if (szx(1) == 1) - yi = reshape (yi, [szx(2), szy(2:end)]); - else - yi = reshape (yi, [szx(1), szy(2:end)]); - endif - else - yi = reshape (yi, [szx, szy(2:end)]); - endif + yi = reshape (yi, [szx, szy(2:end)]); endif endfunction