diff --git a/+quantity/Discrete.m b/+quantity/Discrete.m index 826e34ac121eb41bc9c3a6fc247bc78306ca7548..ba6d07c6cfb42356727738c8de3838c2d2d8aa50 100644 --- a/+quantity/Discrete.m +++ b/+quantity/Discrete.m @@ -1869,6 +1869,28 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ... end end % isdiag() + function result = isnan(obj, anyNan) + % isnan True for Not-a-Number. + % isnan(X) returns an array that contains true's where + % the elements of X are NaN's and false's where they are not. + % + % isnan(X, true) returns the same as any(isnan(X), 'all') + + arguments + obj + anyNan = false; + end + + if anyNan + result = any(isnan(obj.on()), 'all'); + else + result = true(size(obj)); + for it = 1 : numel(obj) + result(it) = any(isnan(obj(it).on()), 'all'); + end + end + end % isnan() + function P = ztzTimes(a, b) assert(size(a,2) == size(b,1)) diff --git a/+unittests/+quantity/testDomain.m b/+unittests/+quantity/testDomain.m index b92c4ff62c07df5763e985e2914f9733bd32f9aa..11ee1963e5db1e7dbf3a4d522e3f796a5a34a554 100644 --- a/+unittests/+quantity/testDomain.m +++ b/+unittests/+quantity/testDomain.m @@ -20,13 +20,13 @@ end function testParser(testCase) -profile on +%profile on d = quantity.Domain.parser('blub', 1, 'grid', 1:3, 'gridName', 'test'); a = quantity.Domain.parser('domain', d); b = quantity.Domain.parser('blabla', 0, 'domain', a); b = quantity.Domain.parser('blabla', 0, 'domain', a, 'blub', 'a'); -profile off -profile viewer +%profile off +%profile viewer testCase.verifyEqual(d, a);