09-09-2024 04:09 PM
Hello,
Relatively new to LabView so I come baring what I hope to be a simple question. Just not very experienced with this.
I have a data set where the y-values are force and the x-values are time. The data is being read from a text file and converted into an array. The data represent a contraction and the beginning of the contraction is defined as the point at which force reaches 1.5% of peak force.
A threshold array was used to identify the beginning of the contraction but I also need to identify the end of the contraction or when the force values falls below the predetermined value.
Everything I've found on the internet suggest using a For Loop, connecting the array and threshold value to a "less than" comparison function inside the For Loop and then wiring the output to a conditional terminal and wiring that to an indicator.
For whatever reason, I'm not having any success. I just need to identify the index of the end of the contraction. Appreciate any help!
09-09-2024 06:16 PM
Go ahead and post your code showing what you've tried.
You can index the array at the border of the for loop, and for each element you can do your comparison. You probably do one type ofcomparison as the values increase, and then switch your comparison from > to < once the start value is found. You can hold your current state (comparison mode) in a shift register if that is helpful. You may want to enable the for loop conditional terminal to stop when your condition is found, or use a while loop.
I think you can also compare the entire array to your comparison value (wire the array to an input terminal of the comparison operator to see what I mean. Now you can just search for changes in boolean values in the resulting array. For this you can check out the Boolean Trigger VI in the OpenG Toolkit, which would make pretty quick work of this for you.
09-09-2024 06:28 PM
Here's a solution that would work for any number of contractions in your data set. You'll need to do some more work to pair the values. And you'll need to OpenG toolkit....
09-10-2024 09:11 AM
@mo103426 wrote:
Hello,
Relatively new to LabView so I come baring what I hope to be a simple question. Just not very experienced with this.
I have a data set where the y-values are force and the x-values are time. The data is being read from a text file and converted into an array. The data represent a contraction and the beginning of the contraction is defined as the point at which force reaches 1.5% of peak force.
A threshold array was used to identify the beginning of the contraction but I also need to identify the end of the contraction or when the force values falls below the predetermined value.
Everything I've found on the internet suggest using a For Loop, connecting the array and threshold value to a "less than" comparison function inside the For Loop and then wiring the output to a conditional terminal and wiring that to an indicator.
For whatever reason, I'm not having any success. I just need to identify the index of the end of the contraction. Appreciate any help!
Your description is a bit vague. What is the "array" of xy data? (A 2D array with two columns? A 1D complex array?) Are the time values spaced equally? (i.e. is there a linear relation between time and array index?)
Sorry, I don't have LabVIEW on this computer, but all you need to do is find Ymax and then threshold into the Y array for 1.5% of that value. then negate the array and threshold into the negated predetermined value starting from the max position. No loop or external toolkit needed.
As a first step, attach some typical data. How much noise is there?