function varargout = median(X, varargin)
%MEDIAN Median value.
%   MEDIAN(X)
%   MEDIAN(X,DIM)
%   MEDIAN(...,NANFLAG)
%   MEDIAN(...,Weights = W)
%   
%   Limitations:
%   Codistributed table and timetable inputs are not supported.
%   
%   See also MEDIAN, CODISTRIBUTED.


%   Copyright 2016-2023 The MathWorks, Inc.

% For tabular inputs throw a specific error. Otherwise flow through the
% MATLAB in-memory function.
if istabular(X)
    error(message("parallel:distributed:TabularMathUnsupported", "MEDIAN"))
else
    varargout = cell(1,max(1,nargout));
    [varargout{:}] = parallel.internal.array.callToolboxFunction( ...
        "matlab/datafun/median", ...
        X, varargin{:});
end
