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: 

extracting multiple arrays from a 1D array

Solved!
Go to solution

I have an analoge signal of low voltage noise and square signals. I want to extract all square signals from the 1D array and put them in a 2D array. The distances between the square waves are not identical. That's why, I cannot divide the 1D array into multiple 1D arrays and search for numbers bigger than the range of the noise. I would be very thankful for any help!

0 Kudos
Message 1 of 18
(3,472 Views)

do you have more info on the separation criteria?

i see that you have lots of 0.0627 and 0.1882 followed by one or more 0s

but then 5.0824 and 5.1451 without any 0s around it


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 2 of 18
(3,469 Views)

the 5.0824 and 5.1451 without any 0s around it is the square wave. everythings else is noise. so I have the criteria that i want to extract all numbers that are, for example, bigger than 1. If I do that, i will have a 1D array of all of those numbers after eachother. I want to extract each square signal separately. the length of the square signal is not always similar. thank you.

0 Kudos
Message 3 of 18
(3,467 Views)

Hi Sarah,

 

search for the beginning of each ">2.5" part/"signal", then search for the end of this part. Use ArraySubset to get the part. Put all this into a loop…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 18
(3,456 Views)
Solution
Accepted by topic author s.steen

Do note that if your pulses are not the same length, your shorter pulses will be padded with 0 at the end when you change to a 2D array to keep all of the rows the same length.  But this code should do what you want.


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
Message 5 of 18
(3,446 Views)
Solution
Accepted by topic author s.steen

my try, crossrulez beat me to it 😉

 

 

separator.png

 

EDIT: fixed corner cases


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 6 of 18
(3,439 Views)

Thank you very much for the reply!

0 Kudos
Message 7 of 18
(3,400 Views)

Thank you so much for the codes!! I will try them!

0 Kudos
Message 8 of 18
(3,399 Views)

What do u mean by the 2.5 part?

0 Kudos
Message 9 of 18
(3,392 Views)

Hi Sarah,

 

it really helps when you write the name of the person you are asking instead of "u"…

 

The ">2.5" part is explained in crossrulz' snippet!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 18
(3,388 Views)