LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Removing Negative numbers from an array

Hello everyboday,
So far I have this

Untitled.png

 

After the user inputting the array elements, I want the program to remove negative elements and replace them with null,
Meaning simply removing them.
Here however, the program is replacing the negative elements with the value of zero, and I don't want that, I don't know with what I should replace the constant zero, or even if the whole program is correct.
Excuse me, but I'm still new to lab view, any help will be much appreciated !

0 Kudos
Message 1 of 7
(4,217 Views)

Null is not a valid DBL numeric. Can you explain what you want as replacement for negative values? (e.g. NaN). Or do you want to make the output array smaller by removing the negative elements and making the output array shorter??

 

Your code is about 90% too complicated. Learn about autoindexing!!!

 

What is your LabVIEW version? Do you have conditional tunnels?

 

In any case, this looks like homework. There are plenty of examples in the forum that show how to do all that. Did you try a search?

0 Kudos
Message 2 of 7
(4,212 Views)

Untitled.png

 

 

 

That's what I mean removing all the negative values, having a smaller array yes!.

And I have the 2011 version

0 Kudos
Message 3 of 7
(4,205 Views)

So what is giving you problems?

0 Kudos
Message 4 of 7
(4,187 Views)

With Build Array/shift register and also the new conditional tunnel.

 

 

EDIT:  Fixed lower loop.

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

@RavensFan wrote:

With Build Array/shift register and also the new conditional tunnel.

 

(original image deleted, new one is OK)


 

Your lower version will not work. Is that intentional? 😄

0 Kudos
Message 6 of 7
(4,179 Views)

Dohhh.  Not intentional.  I started with the upper loop.  Copied, then broke the shift register.  But forgot to delete the empty array constant.  The broken shift register turned into an auto-indexing tunnel.

 

For that matter, the conditional terminal didn't exist in 2009 which is how I saved my snippet. 

For that matter, my snippet is no longer a snippet.  Because the forums are so broken and won't allow certain file types anymore, I had to resave the image as a jpeg from a .png.

0 Kudos
Message 7 of 7
(4,169 Views)