function z = and(x, y)
%&  Logical AND.
%   Z = X & Y
%   Z = AND(X,Y)
%
%   If X and Y have dimension labels, Z will have a combination of both of
%   their dimension labels. Singleton dimensions (dimensions of size 1) are
%   introduced into X and/or Y to make their dimensions match, and implicit
%   expansion is used in combining X and Y.
%   Singletons are inserted at the end of each block of dimensions with the same 
%   label.
%
%   Example:
%   X has dimensions 'SCB'
%   Y has dimensions 'SSCT'
%
%   X: |S |C|B| |
%   Y: |SS|C| |T|
%   Z: |SS|C|B|T|
%   
%   Output Z has dimensions 'SSCBT'.
%
%   See also AND, DLARRAY.

%   Copyright 2019-2020 The MathWorks, Inc.

% If this file is modified to not be a standard binary element-wise
% broadcast function, please also remove the following template tags.
%#define $BinaryFunction $xdata & $ydata
%#template $BinaryBroadcastTemplate
% Template inserted by deep.dev.generateDlarrayMethods, 2020-02-26 14:14 

% Extract data to work on and create a template output object.  If either
% of the inputs are reusable it will be used as the template output.
[z, fdz, xdata, ydata] = extractBinaryBroadcastData(...
    matlab.lang.internal.move(x), ...
    matlab.lang.internal.move(y));

zdata = matlab.lang.internal.move(xdata) & matlab.lang.internal.move(ydata);

z = restoreBinaryBroadcastData(z, ...
    matlab.lang.internal.move(fdz), ...
    matlab.lang.internal.move(zdata));

%#template
end
