02-10-2012 07:54 AM
Hello,
I would like to obtain an array of clusters of two elements (x,y). The user should be able to choose ending values (ev) of the elements, and the starting value (sv) is always equal to one E.g.:
1. (sv=1, ev=2) gives in the result: (1,1) (1,2) (2,1) (2,2)
2. (sv=1, ev=3)
(1,1) (1,2) (1,3) (2,1) (2,2) (2,3) (3,1) (3,2) (3,3)
3. (sv=1, ev=4)
(1,1) (1,2) (1,3) (1,4) (2,1) (2,2) (2,3) (2,4) (3,1) (3,2) (3,3) (3,4) (4,1) (4,2) (4,3) (4,4)
3. (sv=1, ev=4)
(1,1) (1,2) (1,3) (1,4) (2,1) (2,2) (2,3) (2,4) (3,1) (3,2) (3,3) (3,4) (4,1) (4,2) (4,3) (4,4)
4. and so on…
I am working with LabVIEW 8.6. Any help appreciated.
Thanks!
02-10-2012 08:03 AM
What you ae asking for is trivial using a pair of nested For loops a shift register and a build array node.
Investigate those functions and post images of your code if you get stuck.
Ben
02-10-2012 08:23 AM
Yes, I believe that this is trivial but I am fairly new to LabVIEW. Where should I put the shift register?
02-10-2012 08:43 AM
on the outer For loop. It will acumulate your work as you go.
Post images if you want better help.
Ben
02-10-2012 09:18 AM - edited 02-10-2012 09:19 AM
I have something like this and it works, but think there might be a better solution.
02-10-2012 09:22 AM - edited 02-10-2012 09:23 AM
@johnnypp wrote:
I have something like this and it works, but think there might be a better solution.
What a difference an image makes!
That is better than what I had in mind if you are OK with the 2D array. If you want it to be 1D you can reshape (see array palette) the results to 1-d.
Ben
02-10-2012 09:28 AM
Thanks Ben!
02-10-2012 04:52 PM
Just change the constant 4 to a Control wired to both N's and you've solved the user input question. 🙂
/Y