MATLAB: Combination problem combination Hi suppose I have some values 1 2 3 4. I want to find all possible combination of these four, taking only two distinct element at a time and store it in a matrix. Is there any one to help me? Best Answer It's like?out = nchoosek(1:4,2) Related SolutionsMATLAB: Every combination of elements nchoosek(1:4,2) MATLAB: How do you bring about all possible combinations from two row vectors Yes. Use NDGRID or MESHGRID, e.g.,>> [x,y]=ndgrid([1,2], [3,4])x = 1 1 2 2y = 3 4 3 4>> z=[x(:),y(:)]z = 1 3 2 3 1 4 2 4 Related Question
Best Answer