LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

index of all zero values in 1D array

Solved!
Go to solution
I would like to index all zero values in a 1D array. the problem is my points fluctuate around zero without reaching the zero value. So I need to do interpolation between the points.
I don't know how I can index all zero value. Can you please help me ?
 
regards,
 
Sylvain
0 Kudos
Message 1 of 19
(5,683 Views)

Hi Sylvain,

it should be possible with the "Threshold 1D Array" function.

 

Mike

Message Edited by MikeS81 on 07-28-2009 05:30 PM
0 Kudos
Message 2 of 19
(5,670 Views)

The problem is the VI "Threshold 1D Array" index only the first value egal to zero and doesn't index the other values in the 1D array.

 

Regards,

 

Sylvain

0 Kudos
Message 3 of 19
(5,662 Views)

I would use 'In Range and Coerce'.

Code.PNG

Front Panel.PNG

 

In my example (attached), all values between -0.1 < x < 0.1 will be considered zero.

It then outputs a 2D array of (Index, Value)

Cory K
Message 4 of 19
(5,655 Views)
I would try a variation of this. You can replace the Not Equal To Zero function in that example with the In Range and Coerce.
0 Kudos
Message 5 of 19
(5,648 Views)
Also be careful if you are working with floating point numbers. 1E-22 (as an example) is not equal to zero but it is indeed a small number 😉 


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 6 of 19
(5,649 Views)

If you don't need to interpolate the index you can check for changes in the sign. See example.

Find-Zero-Crossings_BD.png

 

Hope this helps,

Daniel

 

0 Kudos
Message 7 of 19
(5,647 Views)

Indexes.JPGTo build on what smercurio_fc said here is a solution with comments.

 

Message Edited by VADave on 07-28-2009 11:52 AM
Visualize the Solution

CLA

LabVIEW, LabVIEW FPGA
0 Kudos
Message 8 of 19
(5,622 Views)
It precisly my problem, because I'm working with floating poin numbers... I think, i need to use "Threshold 1D Array". What do you think ?
0 Kudos
Message 9 of 19
(5,605 Views)
Could you please show us some sample data, and tell us what you would consider a zero?
Cory K
0 Kudos
Message 10 of 19
(5,595 Views)