# HG changeset patch # User Olaf Till # Date 1332429386 -3600 # Node ID 02308d57f5a467c115429fbd1b247083103068dc # Parent fe0c935a235cbe2c6316bd9b2de20ec58d1e783a Fix dimensions with some methods. diff -r fe0c935a235c -r 02308d57f5a4 scripts/general/interp1.m --- a/scripts/general/interp1.m Tue Jun 14 09:46:24 2011 +0200 +++ b/scripts/general/interp1.m Thu Mar 22 16:16:26 2012 +0100 @@ -248,9 +248,13 @@ if (ispp) y = shiftdim (reshape (y, szy), 1); yi = pchip (x, y); + yi.orient = "first"; else y = shiftdim (y, 1); yi = pchip (x, y, reshape (xi, szx)); + if (! isvector (y)) + yi = shiftdim (yi, 1); + endif endif case {"spline", "*spline"} if (nx == 2 || starmethod) @@ -260,9 +264,13 @@ if (ispp) y = shiftdim (reshape (y, szy), 1); yi = spline (x, y); + yi.orient = "first"; else y = shiftdim (y, 1); yi = spline (x, y, reshape (xi, szx)); + if (! isvector (y)) + yi = shiftdim (yi, 1); + endif endif otherwise error ("interp1: invalid method '%s'", method); @@ -280,20 +288,11 @@ yi(outliers) = extrap; yi = reshape (yi, szx); elseif (!isvector (yi)) - if (strcmp (method, "pchip") || strcmp (method, "*pchip") - ||strcmp (method, "cubic") || strcmp (method, "*cubic") - ||strcmp (method, "spline") || strcmp (method, "*spline")) - yi(:, outliers) = extrap; - yi = shiftdim(yi, 1); - else - yi(outliers, :) = extrap; - endif + yi(outliers, :) = extrap; else yi(outliers.') = extrap; endif endif - else - yi.orient = "first"; endif endfunction