You could use the FEX submission ALLCOMB by Jos for this. E.g.,
x = your original vector of non-negative integers
c = cellfun(@(y)0:y,num2cell(x),'uni',false);
A = allcomb(c{:});
B = bsxfun(@minus,x,A);
The rows of A and B contain all of the possibilities. The usual caveat applies here ... if you have too many numbers with values that are too high this will blow up your memory and you will need to solve your problem a different way.
ALLCOMB can be found here:
https://www.mathworks.com/matlabcentral/fileexchange/10064-allcomb-varargin-
Best Answer