LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combination of input paths/strings

Solved!
Go to solution

Hello,

I would like to improve my VI. Its something like AB subjective assesment of sound quality. The issue is, that the combination od stimulis must be prepaired as pairs. I would like to code the combinatory in app itself. So the point is to make pair combination of input paths or strings (array) and that combination is without repetition. Mathematicaly its for n files n!/2!*(n-2)!. I started programming that in LV, but it was too complex, more than the main VI. I´ve been doing that for 2 hours and finally I did not accidentaly save it. So now I´m quite upset. But anyway, that code was rubbish. Do you have any idea how to solve that?

 

Thank you very much!

0 Kudos
Message 1 of 10
(3,133 Views)

This should work for combinations of two things. This can be extended to solve more than two with recursion. This could be written to run faster, as written there are many array copies being made.

 

Combinations.png

0 Kudos
Message 2 of 10
(3,123 Views)

I did it exactly like you had posted it. But not working.

0 Kudos
Message 3 of 10
(3,099 Views)

Hello Kulovy,

 

I post a working example that might should solve your problem. Please reshape it to fit your application.

 

Regards, TRSns

Piotr Kruczkowski
Certified TestStand Architect
Certified LabVIEW Architect
0 Kudos
Message 4 of 10
(3,066 Views)

Hello TRSns,

thank you for giving me this idea! It took me quite long time to manage how to do it my way. So here is the result. You can see it´s nothing simple, but maybe it´s not the best way to do it. I know that in sequence languages it would be 5 lines of code or so 😄

 

 

0 Kudos
Message 5 of 10
(3,032 Views)

It would make much more sense to attach a VI or snippet. We cannot debug and judge an image.

0 Kudos
Message 6 of 10
(3,011 Views)

Ouch I did´t know thats something like snippets in LV, so here it is:

 

 

 

0 Kudos
Message 7 of 10
(2,994 Views)

Hi, 

 

if you bundled the input values in stead of building a string from them, it would be a lot easier to remove invalid array fields. You would simply check which array fileds have a cluster with NAN value, and remove them (not use them). At the same time you could build a 1-D array with a while loop and shift register, from the clusters that do not have NAN values.

 

Hope that helps, RavenBlack (aka TRSns) 

Piotr Kruczkowski
Certified TestStand Architect
Certified LabVIEW Architect
0 Kudos
Message 8 of 10
(2,964 Views)
Solution
Accepted by Kulovy

Try something like this:

 

 

(I generate the pair indices in seperate code, so it later can be used on any list (filenames, etc.). This is just a quick draft, many improvements are possible.)

 

 

 

Download All
0 Kudos
Message 9 of 10
(2,946 Views)

Wow, simplicity at the best! Thank you altenbach!

0 Kudos
Message 10 of 10
(2,926 Views)