# HG changeset patch # User Thorsten Meyer # Date 1278698181 -7200 # Node ID 6e7590d003dc67c38fe704269337679d1ba8150b # Parent add87b12e63c636cf3486eca67066a78e4988396 Fix bugs in interp2 (bug #29601) diff -r add87b12e63c -r 6e7590d003dc scripts/ChangeLog --- a/scripts/ChangeLog Fri Jul 09 14:12:59 2010 +0200 +++ b/scripts/ChangeLog Fri Jul 09 19:56:21 2010 +0200 @@ -1,3 +1,8 @@ +2010-07-09 Thorsten Meyer + + * general/interp2.m: improve input argument handling and + allow not equally spaced griddata (bug #29601) + 2010-07-08 Jaroslav Hajek * general/accumarray.m: Fix incorrect handling of nondefault fill diff -r add87b12e63c -r 6e7590d003dc scripts/general/interp2.m --- a/scripts/general/interp2.m Fri Jul 09 14:12:59 2010 +0200 +++ b/scripts/general/interp2.m Fri Jul 09 19:56:21 2010 +0200 @@ -318,7 +318,7 @@ else - ## If X and Y vectors produce a grid from them + ## Check dimensions of X and Y if (isvector (X) && isvector (Y)) X = X(:).'; Y = Y(:); @@ -332,10 +332,10 @@ endif endif - ## If Xi and Yi are vectors of different orientation build a grid - if ((rows (XI) == 1 && columns (YI) == 1) - || (columns (XI) == 1 && rows (YI) == 1)) - ## Do nothing + ## Check dimensions of XI and YI + if (isvector (XI) && isvector (YI)) + XI = XI(:).'; + YI = YI(:); elseif (! size_equal (XI, YI)) error ("interp2: XI and YI must be matrices of same size"); endif @@ -409,8 +409,7 @@ function b = isgriddata (X) d1 = diff (X, 1, 1); - d2 = diff (X, 1, 2); - b = all (d1 (:) == 0) & all (d2 (:) == d2 (1)); + b = all (d1 (:) == 0); endfunction ## Compute the bicubic interpolation coefficients