function validateattributes( varargin )
%validateattributes  validate attributes of a distributed array
%   
%   validateattributes(A,CLASSES,ATTRIBUTES)
%   validateattributes(A,CLASSES,ATTRIBUTES,ARGINDEX)
%   validateattributes(A,CLASSES,ATTRIBUTES,FUNCNAME)
%   validateattributes(A,CLASSES,ATTRIBUTES,FUNCNAME,VARNAME)
%   validateattributes(A,CLASSES,ATTRIBUTES,FUNCNAME,VARNAME,ARGINDEX)
%   
%   Example:
%       A = distributed([ 1 2 3; 4 5 6 ]);
%       B = distributed([ 7 8 9; 10 11 12]);
%       C = cat(3, A, B);
%       validateattributes(C,{'numeric'},{'2d'},'my_func','my_var',2)
%   
%   See also: validateattributes
%   


%   Copyright 2014-2018 The MathWorks, Inc.

try
    distributedutil.hValidateAttributes( varargin{:} );
catch e
    myId = 'MATLAB:validateattributes:';
    if strncmp( myId, e.identifier, length(myId) )
        % leave VALIDATEATTRIBUTES on the stack, because there was a misuse
        % of VALIDATEATTRIBUTES itself
        throw(e)
    else
        % strip VALIDATEATTRIBUTES off the stack so that the error looks like
        % it comes from the caller just as if it had hand-coded its input checking
        throwAsCaller( e )
    end
end

