LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Erase zeros in a cluster

Hello, i have a 1D array with a  cluster with 12 elements. The ten first elements are doubles and the two last are booleans. I know this cluster has zeros in his initial positions due to a pre-process. What i want to know is how to delete them, i mean, finally i want a 1D array with a cluster of 12 elements but with non zeros. All the initial positions with 10 zeros (because the 10 doubles) must be delete. My problem is that i can't convert this cluster into an array because it has different data types in it, and i don't know how to do it. Any help will be aprecciate.

 

Thank you all!

0 Kudos
Message 1 of 5
(2,654 Views)

Comparing a double value to 0 is pointless.

 

I am still not understanding what you are trying to do.

You can't just delete items from some clusters and not others.

0 Kudos
Message 2 of 5
(2,649 Views)

You need to determine what you want.

 

If you want an array, all of the elements must be the same data type.

 

If you want different data types, you want a cluster.  If this is your option, STOP calling it an array.  You're only going to confuse yourself and anyone that tries to help you.

 

You're using double.  As a result, you cannot use equals.  Double doesn't respond well to such things.

 

What do you mean by "delete" the 0s?  Do you want something else to be in their place?  You can't delete them otherwise.  You're breaking the idea of a cluster.

 

It sounds like your overall problem is a bad architecture.  Instead of asking us how to fix a broken building, why don't you tell us what your actual problem is and we can see if there's a better architecture for you to work towards.

Message 3 of 5
(2,636 Views)

My guess is that you want something like this.

"If you weren't supposed to push it, it wouldn't be a button."
Message 4 of 5
(2,612 Views)

Ok, thank you and sorry about my mess, im still learning but you're helping me.

 

I'm confused about array and cluster because outside the loop, the context help says that is a 1D array (and i can use the array palette on there), but inside the loop is just a cluster and i can't convert it into an array because the different data types i think. Is that correct?

 

This cluster contains 10 names with a lot of double values written in each "name", isn't? My final aim is to delete the first values (which are zeros) so, the final result must be a cluster which first elements are no-zeros.

 

This is because this cluster is going to be an input of a biomedical processing and when the cluster arrives to that box an error jumps saying that the input is empty (HRV Statistics). The box from which the cluster is built says that the first elements of the cluster are going to be a zeros values due to his algorithm (ECG Features Extractor); so that is my problem, I want to delete or move the cluster to the left so finally the first elements were no-zeros.

 

Guess.vi of paul_cardinale is helping me. In that vi the for loop ends when all the values of the cluster are > 1E-06, that's great; now i need to move the cluster to the left so the first elements were >1E-06. Can i use a "delete from array" outside the loop in which array input was the cluster (because outside the loop i can use it like an array) and the lenght the number of the iteration? Maybe this works...

 

Again, sorry and thank you.

0 Kudos
Message 5 of 5
(2,567 Views)