NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/opnml/basics/isint.m

Revision 495 (checked in by cbc, 12 years ago)

Initial import of Stark code.

Line 
1 %
2 % ISINT determine if input matrix is integers
3 %
4 % ISINT a Matlab function to determine which input matrix positions
5 %       contain an integer or one that can be represented as an integer.
6 %       ISINT returns 1 where matrix entry is integer and a 0 otherwise.
7 %
8 %       If x is a vector or matrix, ISINT returns a vector or matrix
9 %       the same size as x with each element of the input being
10 %       evaluated as above.
11 %
12 %       Ex. 1;  if x=3.2, ISINT returns 0
13 %               if x=3.0, ISINT returns 1
14 %               if x=3, ISINT returns 1
15 %               if x=0, ISINT returns 1
16 %
17 %       Ex. 2;  >> x=[3   3.5
18 %                     4.5 6  ];
19 %               >> isint(x)
20 %                 
21 %               ans = 1 0
22 %                     0 1
23 %
24 %
25 % Call as: >> retval=isint(x)
26 %
27 % Written by : Brian O. Blanton
28 %
29 function retval=isint(x)
30 %ints=x-floor(x)==0;
31 %retval=ints.*x;
32 retval=x-floor(x)==0;
33
34 %
35 %        Brian O. Blanton
36 %        Curr. in Marine Science
37 %        15-1A Venable Hall
38 %        CB# 3300
39 %        Uni. of North Carolina
40 %        Chapel Hill, NC
41 %                 27599-3300
42 %
43 %        919-962-4466
44 %        blanton@marine.unc.edu
45 %
Note: See TracBrowser for help on using the browser.