LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Eliminating element in an array

I would like to eliminate the element in an array . Here say I want to eliminate all the cells with "0" or "Empty" and put only elements other than "0" or Empty into an new array. Without leaving any space or Cell with emptiness. I had tried and I am having a problem. I had also created a array as expected result. 

Here with I post it. Can any one give a solution. 

 

Thank you

 

With regards

0 Kudos
Message 1 of 9
(2,788 Views)

Hi,

 

Use the Array search function instead of String functions.

 

You can search for a particular element (zero) in the array and use the index to delete or replace with the element required.

 

I have added screen shot of the LabVIEW functions, which searches the Zero and deletes from the Array.

 

Hope this helps

0 Kudos
Message 2 of 9
(2,770 Views)

Hai Vijay,

 

      Thank you. What do u do in False case. Can you send me as VI if possible. So that I can have look. Because I tried similar one before, but in False case still some value either as zero or as empty is getting appended in the new array. I want to know how to block sending data in False case. It would nice if you attach your solution VI so that I can run and see. I am using Labview 2012. Looking forward to hear from you. 

 

Thank you for the same.

 

With regards

0 Kudos
Message 3 of 9
(2,761 Views)

I have added the modified VI. All the best.

0 Kudos
Message 4 of 9
(2,746 Views)

Never use "delete from array" in a tight loop! You should adapt something like this instead.

0 Kudos
Message 5 of 9
(2,718 Views)

@Johannes4u wrote:

I would like to eliminate the element in an array . Here say I want to eliminate all the cells with "0" or "Empty" and put only elements other than "0" or Empty into an new array. Without leaving any space or Cell with emptiness. I had tried and I am having a problem. I had also created a array as expected result. 



Your array of expected resuts contains a lot of elements with empty strings so that does not seem right! Please check your code.

 

Since you have LabVIEW 2012, you can use the conditional tunnel to do exactly what you want with very little code. Here's an example.

 

Message 6 of 9
(2,710 Views)

And here's how you would do it without conditional tunnels. Same result. (the other case is ["", "0"] and is simply wired across).

 

 

Message 7 of 9
(2,705 Views)

Here's a thread over on LAVA that is a good read.  We went through trying to improve the OpenG Array functions.  You'll find some interesting tricks in there.

OpenG filter array revised


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 9
(2,657 Views)

Thank you Mr. Altenbach.

 

With Regards

0 Kudos
Message 9 of 9
(2,606 Views)