function mustBeNonzero(A)
%MUSTBENONZERO Validate that value is nonzero
%   MUSTBENONZERO(A) throws an error if A contains a value that is zero.
%
%   Class support:
%   All numeric classes, logical
%   MATLAB classes that define these methods:
%       eq, isnumeric, islogical
%
%   See also: MUSTBENUMERICORLOGICAL.
        
%   Copyright 2016-2020 The MathWorks, Inc.
    
    if ~isnumeric(A) && ~islogical(A)
        throwAsCaller(createValidatorException('MATLAB:validators:mustBeNumericOrLogical'));
    end

    if any(A == 0, 'all')
        throwAsCaller(createValidatorException('MATLAB:validators:mustBeNonzero')); 
    end
end
