LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

delete nth line of array

Solved!
Go to solution

Hey guys,

 

I have an array of numbers with roughly 250,000 lines.  I want to give the user the ability to delete every nth line depending on the user choice.  The program that I have developed and attached takes nearly an hour.  Is there a faster way to execute this?

 

There are a few random indicator in there so I can see interations vs. amount of lines.21157iB1A5C03EAC2DC495

0 Kudos
Message 1 of 10
(5,310 Views)

Yes, operate in place. Please attach your actual VI with some typical data instead of an image.

 

Delete from array must create a new copy in memory, moving all higher elements down one slot. Very inefficient!

 

0 Kudos
Message 2 of 10
(5,304 Views)

Both VI and the data to be used is attached.  The data file is only a portion of it because the original file is too large to post

Download All
0 Kudos
Message 3 of 10
(5,274 Views)

Perhaps you can simply adapt this example from the one and only ... http://forums.ni.com/t5/LabVIEW/deleting-data-from-array/m-p/916956#M412811

0 Kudos
Message 4 of 10
(5,261 Views)
Solution
Accepted by Fonzie1104

 


@Fonzie1104 wrote:

Both VI and the data to be used is attached.


 

Please don't use weird characters in file names....

 

Try this. (Attached VI is in LabVIEW 8.6). See if it is any faster. 😄

Modify as needed.

 

 

Download All
0 Kudos
Message 5 of 10
(5,247 Views)

Soo... how much faster was it on the full array. 😄

 

(BTW: if you have huge datasets, I would not send them all to a gigantic indicator. Maybe write them back to a file or only display a subset, for example.)

0 Kudos
Message 6 of 10
(5,227 Views)

I actually have it being written to a file.  I was just using the indicator to see if it was working but it was a LOT faster.  It's done in less the a min so def. a lot faster than an hour haha.  Thanks!

0 Kudos
Message 7 of 10
(5,206 Views)

Since you are just shuffling entire rows, it might be faster if you just operate on a 1D array, one element per line instead. (Why parse all the row elements separately if we are not interested in the row details??? 🐵

 

See if it is any faster....

 

Download All
0 Kudos
Message 8 of 10
(5,200 Views)

It took about the same time.  The first way you posted worked the best for me.  Thanks again!  I have another question. In order to get that data that I am working with, I need to parse rather large files.  I have attached a portion of one of the original data files.  The thing I am trying to do is parse the data in such a way that I have the date/time in one array (string array), and the data in another array (number array).  The data that is attached looks similar to:

 

date 1, time 1, data 1, date 2, time 2, data 2, date 3, time 3, data 3....

 

Now when the DAQ takes the 2nd data point (data 2), the first data point (data 1) remains the same so we are trying to parse it to look like:

 

date 1     time 1     data 1

date 2     time 2     data 1     data 2

date 3     time 3     data 1     data 2     data 3

 

The time bases are different but we want to keep the previous data that was recorded and show the new point within that row every new date/time.  The program I am using again takes hours and hours to complete and I'm sure it's a similar issue as before.  I posted this issue before but I thought this technique you just showed me could be used in the same way. I don't have enough experience in LabVIEW to understand how the memory is reacting to my program.  I attached my VI but chances are it's way too complicated for you to follow but it works (I know a lot of it is probably not necessary or some parts are the long way about doing it but I just started LabVIEW this summer)  Any input is much appreciated!

 

I was trying to develop a new program to determine if a number in the string is a time or data point.  Then it would send it to its appropriate array.  I couldn't get anything to execute properly.

Download All
0 Kudos
Message 9 of 10
(5,190 Views)

I attached one of the output files that we were getting.  This is a string but we are looking to get it into the two seperate array files.  The first with date/time and the other with the raw data.

0 Kudos
Message 10 of 10
(5,188 Views)