time | Calls | line |
---|
| | 1 | function [tf,isInt] = isIntegerVals(x,lower,upper) %#codegen
|
| | 2 | %ISINTEGERVALS Require an array of integer values
|
| | 3 | % T = ISINTEGERVALS(X) returns true if X contains integer values, and false
|
| | 4 | % otherwise.
|
| | 5 | %
|
| | 6 | % T = ISINTEGERVALS(X,0) returns true if X contains non-negative integer
|
| | 7 | % values, and false otherwise.
|
| | 8 | %
|
| | 9 | % T = ISINTEGERVALS(X,1) returns true if X contains positive integer values,
|
| | 10 | % and false otherwise.
|
| | 11 | %
|
| | 12 | % T = ISINTEGERVALS(X,LOWER,UPPER) returns true if X contains integer values
|
| | 13 | % from LOWER to UPPER, and false otherwise.
|
| | 14 | %
|
| | 15 | % [T,ISINT] = ISINTEGERVALS(X,...) returns true in ISINT if X contains
|
| | 16 | % integer values, even if they are not within the desired range.
|
| | 17 |
|
| | 18 |
|
| | 19 | % Copyright 2013-2019 The MathWorks, Inc.
|
| | 20 |
|
< 0.001 | 2 | 21 | isInt = isnumeric(x) && isreal(x) && all(round(x(:)) == x(:)) && all(isfinite(x(:)));
|
< 0.001 | 2 | 22 | if nargin == 1
|
| | 23 | tf = isInt;
|
< 0.001 | 2 | 24 | elseif nargin == 2
|
< 0.001 | 2 | 25 | tf = isInt && all(x(:) >= lower);
|
| | 26 | else % nargin == 3
|
| | 27 | tf = isInt && all((lower <= x(:)) & (x(:) <= upper));
|
< 0.001 | 2 | 28 | end
|
Other subfunctions in this file are not included in this listing.