05-19-2006 10:33 PM
I’m a beginner with LabView and trying to figure out how to generate an array that contains a factorial arrangement of numbers. I'm currently using nested loops where each row contains the value of each loop for that iteration.
I’ve tried initializing an array and then passing that initialized array through shift registers to the inner loop, and then wiring to a Replace Array Subset. However, I’m not sure how to handle the indexing. For instance, if there are 4 loops, each set to N=5, this would be a total of 625 rows. The first column and first five rows (inner loop) would be 0, 1, 2, 3, 4. This pattern would repeat 125 times in the first column. Likewise, the outer array (fourth column) would result in 125 0s, then 125 1s, 125 2s, 125 3s, and 125 4s.
Any suggestions on what I'm missing and/or the approach I should be using?
Randy
05-19-2006 11:38 PM
05-20-2006 12:19 AM
05-20-2006 08:51 AM
Thanks for the feedback. I attached an Excel file containing the type of 2-D array I am trying to produce in LabView. The information in the array relates to the factorial arrangement of treatments in an experimental design. This particular example would contain 4 factors with each factor having 5 levels, resulting in 5x5x5x5 or 625 treatment combinations. I’m trying to generate these treatment combinations. The result will be a 2-D array where each row contains the level of each of the factors for that treatment combination. For example, a row that contains 3-2-0-4 would be the treatment where factor 1 is at level 3, factor 2 is at level 2, factor 3 is at level 0, and factor 4 is at level 4. A factor would be something like “Temperature.” Then, for the factor “Temperature” the levels would be five different temperatures. The other factors would likewise have 5 levels. The resulting experiment would be every permutation of these 4 factors at 5 levels each.
I have been trying to use 4 nested loops to build this 2D array. I thought I could record the value of each of the 4 loops after each iteration of the inner loop to generate the table shown in the Excel file. Each column represents a factor and each row one loop iteration.
I completed the two beginner courses in LabView and this is the first project I have set myself to.
05-20-2006 11:53 AM - edited 05-20-2006 11:53 AM
Message Edited by altenbach on 05-20-2006 09:53 AM
05-20-2006 02:07 PM
altenbach,
Your solution is Fantastic! I was not even aware of the Quotient & Remainder function. However, now I’m just curious to understand how a nested loop approach could be used to solve this type of problem.
RPN
05-20-2006 02:20 PM - edited 05-20-2006 02:20 PM
Message Edited by altenbach on 05-20-2006 12:20 PM
05-20-2006 02:38 PM - edited 05-20-2006 02:38 PM
Message Edited by altenbach on 05-20-2006 12:39 PM
05-20-2006 08:28 PM
altenbach,
This is great. I really appreciate you providing these different options. Apart from solving this specific problem, being able to compare and contrast them is extremely helpful to me as I learn LabView.
Best regards,
Randy