LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to manipulate values of a 2D array

Hi, I recently made another topic regarding how to choose a specific index. The problem I stumbled upon was when I saves my program, the values I inputted to the front panel were removed. So i'm trying to create something that gives the 2D array the values I need at the start of the program. This is what i've made so far. But the problem is that the first column is suppose to increment by 0,5 from -1,5 to 8, it can be done if I do it in a 1D array. And the second column is suppose to square the value. So first column is X and second is X^2. But every guide I check I constantly see everyone using the random number and it's getting quite frustrating. Because I need X values in the first column and X^2 in the second and not random values. Could someone help me understand the logic here. Because I can't seem to grasp it.

 

dasdadad.PNG

0 Kudos
Message 1 of 3
(1,387 Views)
The first thing to notice is that the inner for loop is doing the same thing twice. Your input tunnel is not changing between the 1st and 2nd iteration, that's why you see the same value in col 1 and col 2.
If you have a single element coming out of a for loop, it autoindexes into a 1D array. If you have an array coming out, it autoindexes so that each array is a new row of a 2D array.

What you really want to do is to get rid of the inner for loop, replace it with "built array". Put your input value into the first terminal and the squared value into the second terminal, and these will become rows in the output array.

If you have an indicator that you want to keep default values you, in you can select it, go to "edit >> make selected values default". Or you could right click on it on the block diagram and make it into a constant.
0 Kudos
Message 2 of 3
(1,364 Views)

You have a start, an end and a delta, so if you have LabVIEW Full oder Professional Development System you can use the 'Signal Processing' --> 'Signal Generation' --> 'Ramp Pattern' function.

 

Ramp.PNG

0 Kudos
Message 3 of 3
(1,331 Views)