# HG changeset patch # User Ben Abbott # Date 1323045478 18000 # Node ID e58963b5c0b11d02febc7194d945e3398fc04f18 # Parent e1f76bfe0452a6a9f789ca1a209e5cfb4616cf66 image.m: Fix test for non-linearly spaced coordinates. diff -r e1f76bfe0452 -r e58963b5c0b1 scripts/image/image.m --- a/scripts/image/image.m Sun Dec 04 16:17:45 2011 -0500 +++ b/scripts/image/image.m Sun Dec 04 19:37:58 2011 -0500 @@ -96,8 +96,6 @@ function h = __img__ (x, y, img, varargin) - persistent warn = true - newplot (); if (isempty (img)) @@ -115,9 +113,13 @@ xdata = [x(1), x(end)]; ydata = [y(1), y(end)]; - if ((numel (unique (diff (x))) > 1 || numel (unique (diff (y))) > 1) && warn) + dx = diff (x); + dy = diff (y); + dx = std (dx) / mean (abs (dx)); + dy = std (dy) / mean (abs (dy)); + tol = 100*eps; + if (any (dx > tol) || any (dy > tol)) warning ("Image does not map to non-linearly spaced coordinates") - warn = false; endif ca = gca ();