LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

split array

Trying, serching and reading for hours, but cant get it right: I have a waveform array going over and under zero (lets say as a sound wave). I want to separate the positive waves from the negative ones and select the longest positive to continue calculations (and discard the rest). Please can someone help me? I´ve read a lot but cant split if I don´t know at which point. A bolean IF funtion for one value >0 AND and one <0 maybe? And then the opposite? Any suggestions?

 

Martin

 

"Physician, researcher and programmer wannabe."
0 Kudos
Message 1 of 5
(2,914 Views)

Hi madoc,

 

You may go through the attached vi to see how it can be done. I have used a sine wave simulator to explain it. 

Regards,


Nitzz

(Give kudos to good Answers and Mark it as a Solution if your problem is Solved;)) 

Message 2 of 5
(2,900 Views)

Here's a quick draft. It probably needs a few tweaks.

 

It finds the largest stretch of consecutive non-negative numbers from a 1D array, then takes it as a subset for further prcessing.

(There is also a way to only keep the longest subet, without building the array pf positive subsets first. Try it. ;))

Message 3 of 5
(2,887 Views)

Thanks - I´ll dig into it and be back!

 

You guys are great! /M

"Physician, researcher and programmer wannabe."
0 Kudos
Message 4 of 5
(2,878 Views)

I managed the sorting, but altenbachs isolation of the longest stretch really did it!

 

Thanks a lot! Martin

"Physician, researcher and programmer wannabe."
0 Kudos
Message 5 of 5
(2,859 Views)