MATLAB: How to set mutually exclusive arguments in matlab

argumentsMATLABmatlab function

How to use the new "arguments" parameter qualifier to control mutually exclusive two(or more) parameters as function inputs?
for example:
function out = twoStats(x,y)
arguments
% If you have input x, you cannot input y
% If you have input y, you cannot input x
end
end
similar question:

Best Answer

function out = twoStats(x,y)
arguments
x = [];
y {MustBeExclusive(x,y)} = [];
end
% out = ...
end
function MustBeExclusive(varargin)
if sum(cellfun('isempty',varargin)) ~= 1
eid = 'XY:NotExclusive';
msg = 'X and Y must be exclusive.';
throwAsCaller(MException(eid,msg))
end
end