MATLAB: What is the source code of the function combnk

combinationscombinations matrixcombnk

I need to make a matrix of all combinations of an integer array, but want the combinations to occupy only the even numbered rows. The odd numbered ones will be filled with a number that is related to each array element. Like in the odds are the x's of a function and in the evens are the Y's.

Best Answer

At the command line, type
dbtype combnk
If you want the combinations to only occupy every second element, then generate them in an array and then write them into every second element. For example,
T = combnk(7, 3);
R(:, 1:2:end) = T;