Suppose I have a matrix defined as follows
M = [C1 C2 C3 C4]
Where the C\'s are column vectors I want some efficient (i.e. no for loops) wa
This is the simplest way I've come up with:
n = size(M, 2); [j, i] = ind2sub([n n], find(~triu(ones(n)))); ResultVec = M(:, [i j]); ResultVec = reshape(ResultVec, [], 2)