How can I create list of permutations

Hi Everyone,
I need to create a 2 d array which will contain all of the permutations of a 1d input array, specifically, I have a 1 d array of colour boxes and I want to return a 2 d array of colour boxes.  This is too mathematical for me!  Is there a combination of functions that will help me achieve this?  From my days at college I remember something about factorials, but as for coding it...
If anyone has any suggestions I would be very grateful.
Thank you,
Michael.
Solved!
Go to Solution.

Assuming that all colors in the input array are unique, here's a simple algorithm (LabVIEW 8.5). (see also)
The permutation algorithm is from wikipedia:
For every number k, with 0 = k < n!, the following algorithm generates a unique permutation of the initial sequence sj, j = 1, ..., n:
function permutation(k, s) {
     for j = 2 to length(s) {
        swap s[(k mod j) + 1] with s[j]; // note that our array is indexed starting at 1
        k := k / j;        // integer division cuts off the remainder
     return s;
NOTE: Indexing in LabVIEW starts at 0, so the code is changed accordingly.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
permutate.PNG ‏19 KB
permutate.vi ‏13 KB

Similar Messages

  • How can i create list box and  dropdown in my report?

    dear experts
    how can i create list box and  dropdown in my report?
    thanks  in advance

    Pl. see the code given below.
    REPORT Z_LISTBOX.
    Data declaration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    TYPE-POOLS: VRM.
    DATA: NAME  TYPE VRM_ID,
          LIST  TYPE VRM_VALUES,
          VALUE LIKE LINE OF LIST.
    Selection screen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    PARAMETERS: PS_PARM(10) AS LISTBOX VISIBLE LENGTH 10.
    AT SELECTION SCREEN OUTPUT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    AT SELECTION-SCREEN OUTPUT.
      NAME = 'PS_PARM'.
      VALUE-KEY = '1'.
      VALUE-TEXT = 'Line 1'.
      APPEND VALUE TO LIST.
      VALUE-KEY = '2'.
      VALUE-TEXT = 'Line 2'.
      APPEND VALUE TO LIST.
      CALL FUNCTION 'VRM_SET_VALUES'
           EXPORTING
                ID     = NAME
                VALUES = LIST.
    START-OF-SELECTION.
    Regards,
    Joy.

  • How can I create a matrix question? Specifically, I need a question in table format that allows each respondent to list a number of events and then data for each event (date, location, number of participants, topics covered, etc.

    How can I create a matrix question? Specifically, I need a question in table format that allows each respondent to list a number of events and then data for each event (date, location, number of participants, topics covered, etc.

    Hi,
    Sorry, we do not support a matrix-question field.   Please try the multilines text field (where your participant can enter multiple lines in the input text box) and see if it works for you.
    Thanks,
    Lucia

  • How can a distribution list be created on Apple email

    How can a distribution list be created on Apple email?

    you can import excel contact lists if you like: http://smallbusiness.chron.com/import-email-addresses-mac-address-book-excel-wor ksheet-39748.html

  • Hi folks, you might know how to fix this: my wifi shows (no hardware installed) then I went to system preferences and deleted the wifi connection, I went also to system information and I can not see wifi listed on Network, how can I create a new wifi ?

    Hi folks, you might know how to fix this: my wifi shows (no hardware installed) then I went to system preferences and deleted the wifi connection, I went also to system information and I can not see wifi listed on Network, how can I create a new wifi or simply solve this, I have tryied shotdown pressing keys like P and R, option, etc. Please help me .

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you turn on the computer, and again when you log in.
    Note: If FileVault is enabled, or if a firmware password is set, or if the startup volume is a Fusion Drive or a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output on certain models. The next normal startup may also be somewhat slow.
    The login screen appears even if you usually login automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem?
    After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of the test.

  • How can I create email distribution lists in my contacts on my macbook air?

    How can I create email distribution lists in my contacts on my macbook air? I could do this on a pc using outlook, but I don't see how to do it on my new mac.

    UPDATE, ok, I figured out how to make a list, but how can I remove specific contacts from the list? The "Remove from Group" is greyed out & not available.

  • How can I create a property list inside a property list?

    How can I create a property list inside a property list?
    I have a string(that I pulled from a text member). the string
    is actually a propert list.
    the property list has another property list inside it..
    how can I use this list ? how can I conert the text to a list
    that director will understand?
    thanks.

    Not sure if this is what you're wanting, but to make a list
    from a text
    member you could do something like ...
    myList= []
    -- Fill myList with values --
    repeat with i = 1 to member("YourTextMember").line.count
    add myList, (member("YourTextMember").line.i)
    end repeat
    Haven't checked it, but it should work.
    -Matt

  • How can I create a new ring tone for my iPhone 4?

    How can I create a new ring tone for my iPhone 4? I followed the Garage Band process and ended up with the ring tone I want as a AAC audio file. It got stored in my iTunes a a song rather than a ring tone. How do I make it a ring tone vs. a song? I tried dragging it t the Ring Tone category at the bottom of the ITunes list, but it won't alloow me to move it?

    There's also an easy to use Applescript over at Doug's Applescripts for iTunes. It automates the whole thing. All you do is set the start and stop time on a file in iTuens and run the script. It will do everything else.
    Make Ringable v1.1
    http://dougscripts.com/475

  • I have an edit button in my e mail account but when I press it I don't get the ''get new mailbox' button. How can I create e mail folders? Thanks.

    I want to create e mail folders for my goole account. I go to the account and as suggested in the forum i tap on edit. Then instead of getting at the botton a button that says 'new mailbox' i get 2 boxes one red that says delete and one blue that says move. This is on an ipad 2. I have also an ipad 3 and there it does work. I have checked the settings in both ipads and they seem identical to me.
    How can I create the foldesr then on teh ipad 2?
    Thanks a lot!

    You need to be in the mailbox list for the account when you tap edit.
    Sounds like you might be trying to do it from insider you Inbox.
    Matt

  • How can i create a new Adminstrator user account ?

    How can i create a new Adminstrator user account ?

    Go to the System Preferences>Users.
    Click the lock if and enter your password, if necessary.
    Then click on the "+" symbol below the accounts list.
    From the "New Account" menu, select"Administrator" and fill in the rest of the information.
    And finally click the "Create Account" button.
    Done. A new Administrator user account.

  • How can i create a new user with only read rights ?

    How can i create a new user with only read rights ?

    You are asking about a Database User I hope.
    You can look into the Oracle 8i Documentation and find various privillages listed.
    In particular, you may find:
    Chapter 27 Privileges, Roles, and Security Policies
    an intresting chapter.
    You may want to do this with the various tools included with 8i - including the
    Oracle DBA Studio - expand the Security node and you can create USERS and ROLES.
    Or use SQL*Plus. To create a
    user / password named John / Smith, you would login to SQL*Plus as System/manager (or other) and type in:
    Create user John identified by Smith;
    Grant CONNECT to John;
    Grant SELECT ANY TABLE to John;
    commit;
    There is much more you can do
    depending on your needs.
    Please read the documentation.
    -John
    null

  • How can I create a new Numbers Document through AppleScript?

    How can I create a new Numbers Document through AppleScript?
    I try this:
    tell application "Numbers"
    make new document with properties {template name:"blank"}
    end tell
    But don't work.
    Where can I find documentation about it?
    Thanks

    If you try to invent your own syntax, you are starting on very wrong basis.
    The required syntax is defined by the Numbers AppleScript's dictionary.
    This one doesn't know what is a template.
    This is why, in the link posted by badunit, I use an other scheme to create a new document.
    I know that it's awful but it's the only one available at this time.
    Yvan KOENIG (VALLAURIS, France) samedi 4 juin 2011 11:25:25
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.7
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • How can I create a single order from multiple quotations?

    How can I create a single order from multiple quotations that I have created by the transaction VA21 ?
    Thanks in advance for the answers.

    hi
    Go to transaction: /nva01
    Enter order type : ZOR
    Sale org :xxxx
    Dist.channel:xx
    Division :xx
    Press enter
    Click on “Sale document” and select Create with reference
    Then enter 1st quotation number & click on “COPY” or “Selection list”. Then click on “Copy “.Then all line items which belong to quoation1 copy to order.
    Then,
    Click on “Sale document” and select Create with reference
    Then enter 2nd quotation number & click on “COPY” or “Selection list”. Then click on “Copy “.Then all line items which belong to quoation2 copy to order.
    Then,
    Click on “Sale document” and select Create with reference
    Then enter 3rd quotation number & click on “COPY” or “Selection list”. Then click on “Copy “.Then all line items which belong to quoation3 copy to order.
    Now save the sale document.
    Kindly give reward points
    Edited by: WISH on Mar 19, 2008 2:25 PM

  • How can I create a array with all files from a directory

    How can I create a array of files or varchar with all files from a directory?

    I thought the example could be improved upon. I've posted a solution on my blog that doesn't require writing the directory list to a table. It simply returns it as a nested table of files as a SQL datatype. You can find it here:
    http://maclochlainn.wordpress.com/2008/06/05/how-you-can-read-an-external-directory-list-from-sql/

  • Can/How can I create a page with all my blog pages RSS??

    Hello all.
    I have a website containing many seperate Blog pages according to their topics like News, Tech and Scifi.
    Is it possible to create a new page, that will contain the latest entries of all these blog pages a one "consolidated" page, maybe perhaps of RSS feed?
    Thanks and cheers

    Apple states
    How can I create a page that aggregates my podcasts?
    If you have multiple podcasts listed in the iTunes Store, the iTunes staff can create a single page that lists all of them in one place. We call this page an “artist page.” Note that a podcast can only appear on one artist page.
    To request an artist page, navigate to one of your podcasts, click on Report a Concern, and select Remove a Podcast. In the dialog box, explain that you would like an artist page, give us the exact name of the artist (please don’t include “Inc,” “LLC,” etc.), and list the exact feed URLs or links to your podcasts.
    at the bottom of this page
    http://www.apple.com/itunes/podcasts/creatorfaq.html
    I hope two is enough and if not that someone contacts me and maybe even changes the info on the above link.
    Thank you for your input!

Maybe you are looking for

  • Use of tax classification  in material master

    use of tax classification  in material master

  • I cant get my displa to work with Samsung TV

    I am having trouble gettin my Airbook to push the duaply to an external source.

  • Solaris 10 installation gives error "No disk Found"

    During the installation of Solaris 10 on dell XPS400, it gives error that says no Disk found: I have already partitioned by disk in the following manner: 1st partition: 30 GB: NTFS (WIn XP installed) 2nd Partiion: 20 GB: NTFS (data) 3rd Partition: 25

  • Change styles for ebook/print

    I have my book pasted up in InDesign, and I can easily output to PDF or EPUB from the book window. Great. However, I'd like different styles to apply to each format. For example, I want a different first-line paragraph indent level for PDF than for E

  • Authorizations for testing of ABAP Web Services

    Can somebody tell me which authorizations/roles I need to assign to a user with SAP WAS 6.40 ABAP so that he will be able to test a simple ABAP Web Service with the Java Service home page of this service? I tried this with the roles SAP_BC_DWB_ABAPDE