LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

extract non zero indices from a 1D array

Solved!
Go to solution

Hi all,

I want to extract non zero indices from a 1d array. Can anybody suggest me how to go about it.

Regards,
KM
0 Kudos
Message 1 of 7
(4,017 Views)

Hi kamasani,

 

can you explain the term "non-zero indices"?

 

Are you talking about array elements? Do you need non-zero elements?

 

Use a FOR loop to autoindex your array and a conditional output tunnel:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(4,011 Views)

I have a 1d array of  floating point numbers. I need to extract the index numbers of  non zero floating point numbers.

Regards,
KM
0 Kudos
Message 3 of 7
(3,991 Views)

Hi kamasani,

 

you want to know the indeces of non-zero elements?

 

Take my snippet above and do that little change that is needed to get those indices! 🙂

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(3,987 Views)

Hi GerdW,

Thanks for your reply, i am using LV2011,i Undestand what you meant. i doubt conditional auto indexing feature is not available in 2011, i need a little more help.

Regards,
KM
0 Kudos
Message 5 of 7
(3,972 Views)
Solution
Accepted by topic author KevinKM

Hi kamasani,

 

so you need a shift register, a BuildArray node and a case structure.

 

I'm pretty sure you will find examples for such tasks in the forum…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 7
(3,969 Views)

Hi GerdW,

Thanks for your time, I found the solution finally.

Regards,
KM
0 Kudos
Message 7 of 7
(3,964 Views)