# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## The simplest permutations of elements 1... 6

Hello! I am trying to master LabVIEW as part of my training and learning new tools. I am trying different tasks with the functionality of the programme. Now I'm trying to work with arrays, but I don't understand why nothing works. Maybe there are some simple solutions for my task? Looked in the forum, but the tasks are too complicated for me to understand. (LabVIEW ver. 6.0.1b3)

Take all permutations of elements 1, . . . . . 6 .

Message 1 of 4
(226 Views)

## Re: The simplest permutations of elements 1... 6

Hi!

The datatype of your output is double. But the matlab code returns a 2D array of integer values, so the output should be a 2D array of I32 or similar.

Create an input with the same name as the output ("output"), and wire there the desired datatype. The output will then adapt to it.

Message 2 of 4
(213 Views)

## Re: The simplest permutations of elements 1... 6

Didn't get it... 😞

Message 3 of 4
(191 Views)
Solution
Accepted by gkvedumail@gmail.com

## Re: The simplest permutations of elements 1... 6

If you are going to learn LabVIEW, then learn LabVIEW -- there should be no "Matlab Script" in your code (it is much more complicated dealing with two programming paradigms that have different ways of representing data, arithmetic, etc.).

Here are a few questions and assumptions:

1. I assume your "input" is an array of 6 integers, 1 through 6, [1, 2, 3, 4, 5, 6] symbolically.
2. What is your output?  Is it a single Array of 6 integers, a "random permutation" of the input array, e.g. [4, 2, 5, 6, 1, 3]?  Or is it a two-dimensional Array, each element of which is a different permutation of the original 6-element Array?

Point #1 is my assumption.  #2 gets to the heart of the question, What are you trying to do?  The method(s) to solve each of the two #2 tasks have approaches with similarities and differences!

Whatever the task, it is going to involve choosing particular elements of an array and using them to construct another array.  Practice with pencil and paper and an initial array of [1, 2, 3] (you should be able to write down the six permutations, starting with the "identity" permutation [1, 2, 3] -- see if you can arrange them in a pattern (there will be several possible) and then deduce a "rule" for going from one pattern to another.  Test it out with [1, 2, 3, 4], then code it in LabVIEW for [1, 2, 3, 4, 5, 6].

Bob Schor

P.S. -- this problem can be solved with a "recursive VI", one that calls itself, which LabVIEW allows, but is a semi-advanced topic.  Ask your instructor about LabVIEW recursive VIs and revisit this problem at the end of the course.

Message 4 of 4
(166 Views)