02-04-2010 08:16 AM
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
Solved! Go to Solution.
02-04-2010 08:21 AM
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.
02-04-2010 08:32 AM
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.
02-04-2010 08:35 AM
This is one way to do it.
In this example, I am deleting row 2.
02-04-2010 08:46 AM
If you index they array and then do a replace, I think you will avoid one data copy.
02-04-2010 08:53 AM