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.
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.
03-16-2020 12:36 PM
Hello, I am using Threshold detector PtByPt to detect a signal that goes from 0 to -90. I set my threshold to -50 but the detector doesn't detect it, is there a way to negate my input signal or change the "internals" of the Threshold detector PtByPt .VI so it can detect?
It is a waveform signal that consists of Y, dt and t0. I tried to negate but nothing happened.
Thank you for any advice.
03-16-2020 02:25 PM
When you tried to negate your signal (so it would go from 0 to +90), did you *also* negate your threshold value (so it would change from -50 to +50)?
It's been over a decade since I posted with the same question about detecting a threshold crossing from above to below. I think this reply may be the most relevant one to adapt into a pt-by-pt evaluation.
(I solved that original issue via binary search, which operated on a large array after the whole thing had been accumulated. I was only able to do so because of special circumstances that led to my dataset being inherently sorted.)
<time passes>. Actually, I just opened up Threshold Detector PtByPt.vi. That's probably an even easier starting point. Make a copy under a different name in one of your personal folders. There's a >= comparison between the input value and the threshold value. It sure looks like all you need to do to make a threshold detector for descending data is to change that to a <= comparison.
I'd probably put the comparison operator inside a case structure so you could provide a boolean input to specify either ascending or descending data.
-Kevin P
03-16-2020 06:28 PM
Thank you Kevin for your comprehensive reply, that's exactly what I Did. I changed the comparison sign inside the threshold block and it works like a charm now.
I am still working on my project and I encountered another issue which is how to save the position (index) of the threshold detected with the input data to the xls. file.
If I should open new topic for this problem, let me know. In any case, thank you for your help.
Boris
03-19-2020 09:32 AM
@LaBoris:
I would recommend starting a new Topic for "Adding additional Data to an Excel Worksheet". I gather that your question about negative threshold arose from analyzing a row (or column) of data from Excel. You now want to update the Worksheet to add an entry for the Threshold -- do you want to indicate the Threshold value, the Threshold location (within the Array), or both? Depending on how your Worksheet is organized, you could write additional rows/columns with, say, a 2x2 Cell array, Threshold, Threshold Location, and two values. You could also write these data on a separate Worksheet.
If you do post such a query, consider posting an example Excel file so we can make "recommendations that work" for your data.
Bob Schor