function obj = all(obj, varargin)
%ALL True if all elements of a vector are nonzero.
%   A = ALL(X)
%   A = ALL(X,DIM)
%   A = ALL(X,VECDIM)
%   A = ALL(X,'all')
%   
%   The output A has the same dimension labels, if any, as the input X.
%
%   See also ALL, DLARRAY.

%   Copyright 2019-2023 The MathWorks, Inc.
    
if nargin > 1 && ~isa(obj, 'dlarray')
    varargin = extractDlarrayCell(varargin);
    obj = all(obj, varargin{:});
    return;
end

[obj, fdx, xdata, args] = helperReduction(obj, 'all', varargin{:});

xdata = all(xdata, args{:});

obj.FormattedData = insertData(fdx, xdata);
obj = dropTrailingODims(obj);
end
