matlab partition command

Discussion in 'Programming' started by newbie193, Jul 11, 2013.

  1. newbie193



    I have N vectors which look like this:

    [1→m] [m+1→2m] [2m+1→3m] [3m+1→4m] [4m+1→5m]..... [{(N-1)m}+1→Nm]

    I want to select 1 element from each vector without duplication of any combinations.

    Essentially only when all combinations are done with 1st element in first vector ,only then it should move to next element in first vector
    say i have [123] [456] [789]

    my combinations should be like 147, 148 ,149, 157 ,158 ,159 ,167, 168, 169, 247….

    Also, i need no repetitions and only after all combinations of 1 are done only then the loop has to move to next combination ie 247 combination and so on.

    i tried cvpartition command in matlab but it gave me random combinations.I used some statistics commands as well but didnt work the way I want.

    I could do it using for loops in c but is there a way in matlab or matlab command that would fix this?
    Thanks in advance.