07-02-2012 08:41 AM
I have a VI that outputs a excel style 2D array of strings. Sometimes there will be empty rows in between two or more rows of information like below:
[IMG]http://i45.tinypic.com/mmaezd.png[/IMG]
I have done a lot of searching and cant find a solution, how can I delete the empty rows in order to squeeze the information together?
07-02-2012 09:04 AM
Hi,
I found a post discussion the method to delete a column or a row.
http://forums.ni.com/t5/LabVIEW/how-to-delete-columns-from-a-2D-array/td-p/1450846
This works fine for your problem.
You just have to compare the First Element of every row to a EmptyStringConstant.
If the First Element of a row is empty you can delete the row.
To check the whole table place it into a For-Loop.
regards,
adigator
07-02-2012 10:37 AM
Here is an example using a shift register to store "good" rows, and a check to see if all columns in a row are empty.
This is a snippet, save to desktop, drag onto VI.
I used reverse logic for saving to the storage array.
07-03-2012 08:17 AM
If your data sets are very large, try to do this without hitting the LabVIEW memory manager. Given that you are deleting rows, this is fairly simple using a bucket brigade algorithm. I posted an example of this using elements in a 1D array here (see fourth example). It is equally valid for rows in a 2D array. Performance will be orders of magnitude better than the simple solution.
04-23-2013 03:35 PM
I have been working for a couple of days to get this to work. Your snippet finally did it for me. THANKS!