function out = summary(t)
%SUMMARY Print summary of a  codistributed table.
%   SUMMARY(T)
%   
%   See also TABLE/SUMMARY, CODISTRIBUTED.
%   


%   Copyright 2016-2022 The MathWorks, Inc.

if ~istable(t)
    error(message('parallel:array:UnsupportedFunction', upper(mfilename), underlyingType(t)));
end

summaryInfo = distributedutil.calculateSummary(t);
tableProps  = subsref(t, substruct('.', 'Properties' ));
% Only worker 1 prints the result
if spmdIndex==1 && nargout == 0
    matlab.bigdata.internal.util.printSummary(summaryInfo, ...
                                              tableProps);
elseif nargout > 0
    out = matlab.bigdata.internal.util.emitSummary(summaryInfo, ...
                                                   tableProps);
end
end
