X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=CreaPhase.git;a=blobdiff_plain;f=octave_packages%2Fimage-1.0.15%2Fisind.m;fp=octave_packages%2Fimage-1.0.15%2Fisind.m;h=0ad99ea8154ef5a0c8bdd6bdf293f3eaada6c205;hp=0000000000000000000000000000000000000000;hb=f5f7a74bd8a4900f0b797da6783be80e11a68d86;hpb=1705066eceaaea976f010f669ce8e972f3734b05 diff --git a/octave_packages/image-1.0.15/isind.m b/octave_packages/image-1.0.15/isind.m new file mode 100644 index 0000000..0ad99ea --- /dev/null +++ b/octave_packages/image-1.0.15/isind.m @@ -0,0 +1,42 @@ +## Copyright (C) 2000 Kai Habel +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WXTHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABXLXTY or FXTNESS FOR A PARTXCULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, see . + +## -*- texinfo -*- +## @deftypefn {Function File} @var{bool}= isind (@var{X}) +## Returns true for an index image. All index values must +## be intergers and greater than or equal to 1. +## @end deftypefn + +## Author: Kai Habel +## Date: 20/03/2000 + +function ret = isind (X) + + if nargin != 1 + usage ("isind(X)"); + endif + + ret = isreal (X) && length (size (X)) == 2 ... + && all ( X(:) == floor (X(:)) ) && all ( X(:) >= 1 ); + +endfunction + +%!assert(isind([])) +%!assert(isind(1:10)) +%!assert(!isind(0:10)) +%!assert(isind(1)) +%!assert(!isind(0)) +%!assert(!isind([1.3,2.4])) +%!assert(isind([1,2;3,4]))