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?




0 Kudos
Message 1 of 3

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

thanks, seems reasonable, I will try it! cheers

0 Kudos
Message 3 of 3