From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

delete 0 from array

Solved!
Go to solution

how do i delete the 0s from this array? Its been a while and I am still trying to learn how to do this. thanks

 

untitled.PNG

0 Kudos
Message 1 of 19
(15,260 Views)

Just right click the element.  I think it's under data operations delete element.

0 Kudos
Message 2 of 19
(15,255 Views)

Right Click on the element, go to data operations, choose delete.

 

 

-------
Mark Ramsdale
-------
0 Kudos
Message 3 of 19
(15,251 Views)

i have another subvi that creates this array.

i just need to delete 0s somehow.

i need to write a loop to delete it but nothing seems to work

0 Kudos
Message 4 of 19
(15,244 Views)

HINT: For Loop, case structure, build array, shift register, "Equal to 0?"

TailOfGon
Certified LabVIEW Architect 2013
0 Kudos
Message 5 of 19
(15,234 Views)

Please post what you have tried.

 

I would recommend you look at the help files for "Search 1D Array" and "Delete from Array".

 

I would also recommend you do a forum search.

0 Kudos
Message 6 of 19
(15,232 Views)
Solution
Accepted by topic author HelloKristy

Hi,

 

here is a snippet to do that.  Copy to desktop and drag onto VI.

 

Remove zero.png

-------
Mark Ramsdale
-------
0 Kudos
Message 7 of 19
(15,231 Views)

Do you only need to delete from the beginning (all up to the first non-zero value) or throughout the entire array?

 

If the former, use a for loop with the termination set to exit when a non-zero value is found.  Take the iteration, feed that into a subarray primitive.

 

If the latter, use the Search 1D Array function to find the 0s and Delete from Array to remove the elements.


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 19
(15,226 Views)

Mark,  the appropriate function to use in 99% of the cases is Build Array, not Insert into Array.

0 Kudos
Message 9 of 19
(15,216 Views)

Agreed, thanks for the reminder Smiley Happy

-------
Mark Ramsdale
-------
0 Kudos
Message 10 of 19
(15,212 Views)