LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update an array based on a single row?

Hi,
I have an array of 5 rows (numbered 1 to 5) that is constantly updated and I want to be able to have the user select a paticular row that will get appended to the array. For exapmple if the user selects 4 then the array becomes a collection of updates that display just the 4th row. I dont mean that the array becomes only one row but that it puts in the 4th row then the next time there is an update to the 4th row it appends it to the array and so on... such that the array becomes just a collection of the data related to the 4th row (an array of rows that reflect many updates to the 4th row)
0 Kudos
Message 1 of 5
(2,371 Views)
I think an option is to use some boolean logic, the first time you push the 4th boolean, pass data to the 4th row, and then use build array to append the following data. You can use replace array element for the first, and then use build array to apend data.
Hope this helps
0 Kudos
Message 2 of 5
(2,371 Views)
So does that mean I need to make new array each time? I want the user to be able to switch between displaying all the rows or only data for the 1 row. BUt what you are saying is that I need to have 2 different arrays? One for multiple elements and one for just the single ones and alternate which ones to show?
0 Kudos
Message 3 of 5
(2,371 Views)
No, you only need one indicator, but the data coming from the source needs two ways of treatment depending what you want to show.
Excuse me, but english is not my native language, and sometimes i commit errors explaining things.
Good luck
0 Kudos
Message 5 of 5
(2,371 Views)
Helper;

I have an observation about what you want to do.

Let suppose you have the following 2D array:

1 2 3
4 5 6
7 8 9

Now, the user want to append data to the second row. Let say the data is:

3 3

Your updated array will be:

1 2 3 0 0
4 5 6 3 3
7 8 9 0 0

Notice the addition of the zeros, which are necesary to complete the array. Seems to me that you will need some sort of memory to remember where the data must be posted in the remaining rows, because if not, if the user wants now to append data to the first row, he may get the following result:

1 2 3 0 0 4 0 2
4 5 6 3 3 0 0 0
7 8 9 0 0 0 0 0

Assuming the new data was [4 0 2].

Of course, something can be programmed to make sure that the rows are updated correctly, or that the
collected data can be interpreted correctly. On the other hand, it may be easier if you create five 1-D arrays and that when the user select where to store the data, the appropriate array is selected. You should be able to create something easily with a Case structure.

Regards;
Enrique
www.vartortech.com
0 Kudos
Message 4 of 5
(2,371 Views)