+ Reply to Thread
Results 1 to 2 of 2

permutation of values in 2 dimensional array

Hybrid View

Guest permutation of values in 2... 08-21-2006, 12:00 PM
Guest RE: permutation of values in... 08-21-2006, 03:40 PM
  1. #1
    bashir.zain@googlemail.com
    Guest

    permutation of values in 2 dimensional array

    Hi guys,

    I have a 2 dimensional array, Positions(x,y), which has a variable
    number of rows(x) and columns(y):

    e.g. 4 5 3 4
    500 500 800 100
    450 450 750 50
    400 400 700 0
    350 350 -50
    300

    I know the number of columns and the number of rows in each column
    (stored in header of column).

    How can i obtain permutations of all values in each column.... i.e.
    500 500 800 100
    500 500 800 50
    500 500 800 0
    500 500 800 -50
    500 500 750 100
    .....
    .....
    .....
    350 300 700 0
    350 300 700 -50

    I am using VBA and outputting the values to fields in excel.


  2. #2
    Tom Ogilvy
    Guest

    RE: permutation of values in 2 dimensional array

    rw = 1
    for each cell1 in cells(2,1).Resize(cells(1,1),1)
    for each cell2 in cells(2,2).Resize(cells(1,2),1)
    for each cell3 in cells(2,3).Resize(cells(1,3),1)
    for each cell4 in cels(2,4).Resize(cells(1,4),1)
    with worksheets("sheet2")
    .cells(rw,1) = cell1
    .Cells(rw,2) = cell2
    .Cells(rw,3) = cell3
    .Cells(rw,4) = cell4
    rw = rw + 1
    Next cell4
    next cell3
    next cell2
    next cell1

    --
    Regards,
    Tom Ogilvy


    "bashir.zain@googlemail.com" wrote:

    > Hi guys,
    >
    > I have a 2 dimensional array, Positions(x,y), which has a variable
    > number of rows(x) and columns(y):
    >
    > e.g. 4 5 3 4
    > 500 500 800 100
    > 450 450 750 50
    > 400 400 700 0
    > 350 350 -50
    > 300
    >
    > I know the number of columns and the number of rows in each column
    > (stored in header of column).
    >
    > How can i obtain permutations of all values in each column.... i.e.
    > 500 500 800 100
    > 500 500 800 50
    > 500 500 800 0
    > 500 500 800 -50
    > 500 500 750 100
    > .....
    > .....
    > .....
    > 350 300 700 0
    > 350 300 700 -50
    >
    > I am using VBA and outputting the values to fields in excel.
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1