LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete unwanted rows from an array

I am writing some routines for a Fluke Hydra DAQ box.  Once I have the instrument channels configured I read back their configuration.  Before saving to a file I need to delete the lines for the unconfigured channels.  I have tried a variety of ideas and none have worked.  I have example raw and desired finished files to provide anyone who may have some ideas.

Your assistance is appreciated.
0 Kudos
Message 1 of 11
(18,765 Views)

If I understand you completely & the problem is that simle, try using the Delete from Array function, if you  know the unconfigured channels exactly.

Or, post your code.

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 2 of 11
(18,756 Views)

Hi!

Try this.

 

Kaustubh

VIAPL

Message 3 of 11
(18,738 Views)
I always prefer to just iterate through the lines and keep track of an insert point, then just recopy the good lines so they are contiguous. Do all the operations in place!
 
(Maybe you can adapt something like in the following post: http://forums.ni.com/ni/board/message?board.id=170&message.id=274905&jump=true).
 
Using delete from array multiple times in a loop has the following problems:
  1. If you do it with increasing nimbers, the indices change for all higher elements with each delete operation, really confusing things. This problem does not occur if you sort the indices to be deleted in reverse order first.
  2. Each delete operation must shift all higher elements, and this can become very expensive with large datasets. For example, if you delete 1000 elements from a large array, the last element gets copied 1000 times. My method touches each dataset exaclty once and will potentially be orders of magnitude faster.
Message 4 of 11
(18,723 Views)
OpenG has a set of Array functions that you can use for this purpose so you don't have to reinvent the wheel.
0 Kudos
Message 5 of 11
(18,702 Views)
The OpenG Delete Elements from Array just calls the regular delete from array in a loop with a shift register.

Altenbach, did you mean this thread?

Message Edited by Marc A on 10-12-2007 10:21 AM

0 Kudos
Message 6 of 11
(18,696 Views)
Don't have the "Delete Elements from Array" in my OpenG Array palette. Must be different version.

Yes, it's true that many of the OpenG VI are "they're just doing this..." VIs, and veterans may not find them all that inventive. However, they can save time by not having to recode the same thing over and over again. They're also useful for those starting out in LabVIEW to see how to do certain things.
0 Kudos
Message 7 of 11
(18,690 Views)
Delete Elements from Array takes an input array and an array of indices that are to be deleted. It's great for deleting a few elements, but as altenbach showed in the thread I linked, it's very inefficient for large arrays.

I agree with you and love the openG VIs, they do save a lot of time.
0 Kudos
Message 8 of 11
(18,683 Views)
Thanks for your suggestion.

Since I need to conditionally delete from an array  I need to run in a loop.  At most I get one deletion when using the delete function.

I have placed an array in a T/F case structure within a loop so the array is written to when the condition is met.  This case selection then runs in a loop.  The array pointer is incremented by a counter for each write attempt.  The array comes out empty.

I have'nt found a way to selectively load an array on a loop border.

I have tried Replace Array Subset (initialize array then over write), Insert Into Array,  Delete From Array.  The array functions seem to despise conditional loops.
0 Kudos
Message 9 of 11
(18,655 Views)


@OldStudent wrote:
I have tried Replace Array Subset (initialize array then over write), Insert Into Array,  Delete From Array.  The array functions seem to despise conditional loops.

Please attach your code, it will be much easier to tell what's wrong. Make sure you are using a shift register and also make sure you are wiring across the otherwise empty case.
0 Kudos
Message 10 of 11
(18,648 Views)