# HG changeset patch # User Olaf Till # Date 1332411152 -3600 # Node ID ddce832aa9ef00785d28c723bd93af67204ffb53 # Parent fe0c935a235cbe2c6316bd9b2de20ec58d1e783a Fix dimensions with some methods if "extrap" is set. diff -r fe0c935a235c -r ddce832aa9ef 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 11:12:32 2012 +0100 @@ -248,9 +248,10 @@ 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)); + yi = shiftdim (pchip (x, y, reshape (xi, szx)), 1); endif case {"spline", "*spline"} if (nx == 2 || starmethod) @@ -260,9 +261,10 @@ 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)); + yi = shiftdim (spline (x, y, reshape (xi, szx)), 1); endif otherwise error ("interp1: invalid method '%s'", method); @@ -280,14 +282,7 @@ 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