LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate a 2D dynamic array for xy coordinates of equidistant points

Solved!
Go to solution

I would like to make a 2D array of x and y coordinates for 100 particles such that on a 250x250 grid they are "equally spaced out in both x and y coordinates." I would like this array to be dynamic such that if I would like to later simulate 200 or 300 particles, the array would decrease the inter-particle distance and set new coordinates accordingly for the increased rows and columns.

 

Another way, to look at my problem would be that I would like to get "all the combinations" of xy coordinates if I were to specify an upper and lower limit and mention how many equidistant points I want between upper and lower limit. For example:

Lower Limit: 25

Upper Limit: 250

Points between Upper and lower limit: 10

This will give: 25, 50, 75, 100, 125, 150, 175, 200, 225, 250

The next step would be to get all the combinations like shown below from my Python one line code.

 

Thanks for the help. I am new to LabView and would like to implement this in Labview; I would like to give an example what I am looking for. In this example you can see xy coordinates of 100 particles on 250x250 grid which I got from my Python code: np.mgrid[25:250:10j,25:250:10j].T.reshape(-1,2)

 

[[ 25. 25.]
[ 50. 25.]
[ 75. 25.]
[100. 25.]
[125. 25.]
[150. 25.]
[175. 25.]
[200. 25.]
[225. 25.]
[250. 25.]
[ 25. 50.]
[ 50. 50.]
[ 75. 50.]
[100. 50.]
[125. 50.]
[150. 50.]
[175. 50.]
[200. 50.]
[225. 50.]
[250. 50.]
[ 25. 75.]
[ 50. 75.]
[ 75. 75.]
[100. 75.]
[125. 75.]
[150. 75.]
[175. 75.]
[200. 75.]
[225. 75.]
[250. 75.]
[ 25. 100.]
[ 50. 100.]
[ 75. 100.]
[100. 100.]
[125. 100.]
[150. 100.]
[175. 100.]
[200. 100.]
[225. 100.]
[250. 100.]
[ 25. 125.]
[ 50. 125.]
[ 75. 125.]
[100. 125.]
[125. 125.]
[150. 125.]
[175. 125.]
[200. 125.]
[225. 125.]
[250. 125.]
[ 25. 150.]
[ 50. 150.]
[ 75. 150.]
[100. 150.]
[125. 150.]
[150. 150.]
[175. 150.]
[200. 150.]
[225. 150.]
[250. 150.]
[ 25. 175.]
[ 50. 175.]
[ 75. 175.]
[100. 175.]
[125. 175.]
[150. 175.]
[175. 175.]
[200. 175.]
[225. 175.]
[250. 175.]
[ 25. 200.]
[ 50. 200.]
[ 75. 200.]
[100. 200.]
[125. 200.]
[150. 200.]
[175. 200.]
[200. 200.]
[225. 200.]
[250. 200.]
[ 25. 225.]
[ 50. 225.]
[ 75. 225.]
[100. 225.]
[125. 225.]
[150. 225.]
[175. 225.]
[200. 225.]
[225. 225.]
[250. 225.]
[ 25. 250.]
[ 50. 250.]
[ 75. 250.]
[100. 250.]
[125. 250.]
[150. 250.]
[175. 250.]
[200. 250.]
[225. 250.]
[250. 250.]]

0 Kudos
Message 1 of 3
(3,127 Views)
Solution
Accepted by topic author ta1369

You can use the Ramp function to build a 1-D array of equal distant points.

 

You can use a For Loop inside a For Loop acting on each element of that array with auto-indexing tunnels.  Outer For Loop auto-indexes on one copy of the array, the inner on a different copy.  Use regular tunnels to feed elements or the array through the Loop.

 

Message 2 of 3
(3,094 Views)

Thank you so much! Ramp function is really useful !!!

0 Kudos
Message 3 of 3
(3,075 Views)