LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Renumber array rows

Solved!
Go to solution

Hi,

 

I have the following problem which I haven't found solution for, so I was wondering if you can help me.

I have a 2-D array where I store every 10 sec data coming from a serial port.

When new data is available a new row is added to the array. The first column of the 2-D array is just an incremental index which indicate how many data (rows in array) have received so far.

The problem is when I just want to delete a row (any row) from the array. How can I manage to renumber automatically the incremental index of the first column?

Thank you very much in advance

 

Achilles 

0 Kudos
Message 1 of 6
(2,784 Views)

Why not use a shift register to keep track of the index and forget about storing the index value in the array?    

 

You can manipulate the array, but you may run into issues of data copies, etc. that makes it inefficient.

 

 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 2 of 6
(2,782 Views)

Thank you for your answer. I keep the indexing in the first column of array for two reasons:

 

1. I am displaying the data in a table and they have asked me the first column being the index values

 

2. Each time new data comes I am immediately saving them to a spreadsheet file.

 

0 Kudos
Message 3 of 6
(2,777 Views)
Solution
Accepted by topic author achille

This is one way to do it.

 

array manip.PNG

In this example, I am deleting row 2. 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 4 of 6
(2,771 Views)

If you index they array and then do a replace, I think you will avoid one data copy.

 

array manip2.PNG

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 5 of 6
(2,759 Views)
Thank you very much for your help...
0 Kudos
Message 6 of 6
(2,754 Views)