Home > analyzePRF > utilities > isint.m

isint

PURPOSE ^

function f = isint(m)

SYNOPSIS ^

function f = isint(m)

DESCRIPTION ^

 function f = isint(m)

 <m> is a matrix

 return a logical matrix the same size as <m>.
 an element is 1 iff it is a float and finite and exactly equal to an integer.
 specifically:
   f = isfloat(m) & isfinite(m) & m==round(m);

 example:
 isequal(isint([1 1.5 NaN Inf]),[1 0 0 0])

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function f = isint(m)
0002 
0003 % function f = isint(m)
0004 %
0005 % <m> is a matrix
0006 %
0007 % return a logical matrix the same size as <m>.
0008 % an element is 1 iff it is a float and finite and exactly equal to an integer.
0009 % specifically:
0010 %   f = isfloat(m) & isfinite(m) & m==round(m);
0011 %
0012 % example:
0013 % isequal(isint([1 1.5 NaN Inf]),[1 0 0 0])
0014 
0015 % do it
0016 f = isfloat(m) & isfinite(m) & m==round(m);

Generated on Wed 18-Jun-2014 21:47:41 by m2html © 2005