function Y = round(X, varargin)
%ROUND Round towards nearest integer for codistributed array
%   Y = ROUND(X)
%   Y = ROUND(X,N)
%   Y = ROUND(X,N,TYPE)
%   Y = ROUND(...,TieBreaker=DIRECTION)
%   
%   Example:
%   spmd
%       N = 1000;
%       D = codistributed.colon(1, N)./2
%       E = round(D)
%   end
%   
%   See also ROUND, CODISTRIBUTED, CODISTRIBUTED/COLON, CODISTRIBUTED/ZEROS


%   Copyright 2006-2022 The MathWorks, Inc.

narginchk(1,5);

% All arguments except the first are just parameters and should be
% gathered.
if nargin>1
    [varargin{:}] = gather(varargin{:});
    fcn = @(x) round(x,varargin{:});
else
    fcn = @round;
end

Y = codistributed.pElementwiseUnaryOp(fcn, X);
