In my opinion, it should just work for those cases the original paper says. Furthermore, we should not forget compositions and partitions are usually defined for strictly positive integer numbers:

If you personally prefer any other definition (including zeroes, for example) they can be obtained from the one given by this function. See my first post.

Anyway, what Steffen is trying to compute are "weak compositions" and the goal of this function is to compute "compositions". It would be interesting to have a general implementation for "weak compositions" allowing also independent upper and lower bounds for each term.

It is true that this function should return all the compositions/partitions in a cell array (or array when all of them have the same length). Also, it should check the input arguments to avoid prohibited values.

An additional question: what happens if argument "a" takes negative values? Personally, I think it is just as weird as setting a=0.

14 Aug 2012

Save Workspace to Struct
This function allows to save all the variables from the current workspace into a struct array
Author: Andres

Thanks for this function. It would be nice if structure fields where sorted in somehow, e.g.:
WStruct=orderfields(THEWORKSPACE);

BTW, a shorter (but slower) version of the same function would be:
WSVARS = evalin('caller', 'who');
c=cellfun(@(x) evalin('caller',x),WSVARS,'UniformOutput',false);
WStruct2=cell2struct(c,WSVARS,1);