time | Calls | line |
|---|
| | 1 | function mustBeLessThanOrEqual(A, B)
|
| | 2 | %MUSTBELESSTHANOREQUAL Validate that value is less than or equal to a specified value
|
| | 3 | % MUSTBELESSTHANOREQUAL(A,B) throws an error if A is not less than or equal to B.
|
| | 4 | % MATLAB calls le to determine if A is less than or equal to B.
|
| | 5 | %
|
| | 6 | % Class support:
|
| | 7 | % All numeric classes, logical
|
| | 8 | % MATLAB classes that define these methods:
|
| | 9 | % le, isscalar, isreal, isnumeric, islogical
|
| | 10 | %
|
| | 11 | % See also: MUSTBENUMERICORLOGICAL, MUSTBEREAL.
|
| | 12 |
|
| | 13 | % Copyright 2016-2020 The MathWorks, Inc.
|
| | 14 |
|
< 0.001 | 1 | 15 | if ~isscalar(B)
|
| | 16 | throwAsCaller(createValidatorException('MATLAB:validatorUsage:nonScalarSecondInput', 'mustBeLessThanOrEqual'));
|
< 0.001 | 1 | 17 | end
|
| | 18 |
|
< 0.001 | 1 | 19 | if ~isnumeric(B) && ~islogical(B)
|
| | 20 | throwAsCaller(createValidatorException('MATLAB:validatorUsage:nonNumericOrLogicalInput', 'mustBeLessThanOrEqual'));
|
< 0.001 | 1 | 21 | end
|
| | 22 |
|
< 0.001 | 1 | 23 | if ~isnumeric(A) && ~islogical(A)
|
| | 24 | throwAsCaller(createValidatorException('MATLAB:validators:mustBeNumericOrLogical'));
|
< 0.001 | 1 | 25 | end
|
| | 26 |
|
< 0.001 | 1 | 27 | if ~isreal(B)
|
| | 28 | throwAsCaller(createValidatorException('MATLAB:validatorUsage:nonRealInput', 'mustBeLessThanOrEqual'));
|
< 0.001 | 1 | 29 | end
|
| | 30 |
|
< 0.001 | 1 | 31 | if ~isreal(A)
|
| | 32 | throwAsCaller(createValidatorException('MATLAB:validators:mustBeReal'));
|
< 0.001 | 1 | 33 | end
|
| | 34 |
|
< 0.001 | 1 | 35 | if ~all(A(:) <= B)
|
| | 36 | throwAsCaller(createValidatorExceptionWithValue(...
|
| | 37 | createPrintableScalar(B),...
|
| | 38 | 'MATLAB:validators:mustBeLessThanOrEqualGenericText',...
|
| | 39 | 'MATLAB:validators:mustBeLessThanOrEqual'));
|
< 0.001 | 1 | 40 | end
|
< 0.001 | 1 | 41 | end
|
Other subfunctions in this file are not included in this listing.