LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

remove a row of strings from a 2d array

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?

0 Kudos
Message 1 of 5
(7,102 Views)

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

0 Kudos
Message 2 of 5
(7,097 Views)

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.

 

 

 

 

delete empty rows.png

 

 

I used reverse logic for saving to the storage array.

-------
Mark Ramsdale
-------
Message 3 of 5
(7,085 Views)

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.

0 Kudos
Message 4 of 5
(7,061 Views)

I have been working for a couple of days to get this to work. Your snippet finally did it for me. THANKS!

0 Kudos
Message 5 of 5
(6,879 Views)