ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array of clusters

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!


0 Kudos
Message 1 of 8
(4,310 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 8
(4,305 Views)

Yes, I believe that this is trivial but I am fairly new to LabVIEW. Where should I put the shift register?

0 Kudos
Message 3 of 8
(4,295 Views)

on the outer For loop. It will acumulate your work as you go.

 

Post images if you want better help.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 8
(4,284 Views)

I have something like this and it works, but think there might be a better solution.

Message 5 of 8
(4,271 Views)

@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

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 8
(4,265 Views)

Thanks Ben!

0 Kudos
Message 7 of 8
(4,257 Views)

Just change the constant 4 to a Control wired to both N's and you've solved the user input question. 🙂

 

/Y 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 8
(4,234 Views)