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: 

mask data to NaN based on a threshold

I am using the Frequency Response Function VI to produce a frequency response based on a broadband noise input X and a response signal Y. I want to use the coherence output (cf) to mask the data (A) and reject 'bad' data.

In matlab this would be something like the following:

 

mask = (cf > threshold);

badlocations = find(mask == 0);

A(badlocations) = NaN;

 

This would replace all the data in A with NaN when the coherence function cf is greater than some threshold.

I have no clue how to do this in Labview!! (Although could just use a mathscript node). Help?

 

Dave

 

0 Kudos
Message 1 of 3
(2,464 Views)

Try this.

 

You can do a Replace Array Subset looking through each element one by one and replacing it with NaN.

 

Or as I'm doing here, do the comparison on the array all at once.  Based on that create and array of 1's and NaN's to multiply the first array by so you get an array of valid numbers or NaN's.

 

Message 2 of 3
(2,460 Views)

thanks, seems reasonable, I will try it! cheers

0 Kudos
Message 3 of 3
(2,451 Views)