Mercurial > hg > octave-lojdl
changeset 13993:e58963b5c0b1
image.m: Fix test for non-linearly spaced coordinates.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sun, 04 Dec 2011 19:37:58 -0500 |
parents | e1f76bfe0452 |
children | 99f039289e95 |
files | scripts/image/image.m |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/image/image.m +++ b/scripts/image/image.m @@ -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 ();