LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I'm trying to build an array that looks like this:

The user inputs : 1) number of levels e.g. 3
2) number of angles e.g. 2
3) spacing between angles e.g. 20

The output i'm trying to get is an array that looks like this :

0 20 40

1 x x

2 x x

3 x x

where the x's are not constants but calculated values.
Any help is greatly appreciated.
0 Kudos
Message 1 of 6
(3,136 Views)
I'm not real sure on what the values of this array are supposed to be. Is the array itself only supposed to be the x's? Those create a 2X3 array, which is what seems to be described by the criteria (3 levels, 2 angles). If all you need is an array of that size, just use the Initialize Array VI to create an array of 2 dimensions (drag the bottom of the VI down). After you have created the array, you can insert the values you want by using the Replace Array Subset function.
J.R. Allen
Message 2 of 6
(3,136 Views)
I'm trying to get the output array exactly like its shown and not only the x's. Including the levels going down vertically to the user specified limit and the angles, equally spaced horizontally.

If not directly possible, is there a way to add those as an extra row and column onto the output?
Message 3 of 6
(3,136 Views)
You can definitely do this. You just have to play with the arrays. I'm attached a small VI to demonstrate how you can do this.
J.R. Allen
Message 4 of 6
(3,136 Views)
Thanks JRA, that was great. I'm just curious though, is there a way you can change each individual component of the array, besides the first column and row. I'm pretty sure you can do them one at a time using "insert into array", but can it be done throughout the array, say based on some reading it makes with a probe?
0 Kudos
Message 5 of 6
(3,136 Views)
You sure can. Use the Replace Array Subset VI and wire in the correct row and column indices to tell it which element to replace. This will do it for you. Best of luck!
J.R. Allen
Message 6 of 6
(3,136 Views)