05-30-2021 11:53 AM
Hello all,
I am a novice to LabVIEW and am struggling with an issue with while/for loops. I am analyzing 30 isokinetic muscle contractions and am trying to obtain the torque produced during the contractions, but only when the subject had reached the desired speed (178-180 deg/sec). My goal is to have the program be able to spit out values after it runs all 30 contractions, but when I run my vi currently, it only runs the first contraction continuously. I have it calculating the total amount of samples analyzed for the first contraction and tried using that with shift registers to tell the while loop when it should begin the next iteration in time, but to no luck. Any help on this issue would be greatly helpful.
I will attach my vi to this post. Thank you in advance!
05-30-2021 12:06 PM - edited 05-30-2021 12:07 PM
Hi Ben,
@BenDalton wrote:
My goal is to have the program be able to spit out values after it runs all 30 contractions, but when I run my vi currently, it only runs the first contraction continuously.
Because in each iteration you start to search from the beginning again!
You need to store the current search result in a shift register and in the next register you need to search after that index…
Btw. those WHILE loops used for searching should be autoindexing FOR loops…
05-30-2021 01:05 PM
Hi Gerd,
Thank you for the response! I have added the shift registers and changed the while loops to for loops, but I guess I am confused how I wire the shift register to then have the for loop start the next iteration at the correct time. I will attach what the changes to my vi that I made.
Thank you so much again for the help.
05-30-2021 01:55 PM
Can you run your VI once more until "vel" and "TQ" show typical data, make that data the default, and attach it once more so we can actually play with it?
How much noise is there? What are you actually trying to do? Your current code seems extremely convoluted.
05-30-2021 04:16 PM
Hello,
I know that this isn't exactly what you're asking for, but as a "noob" with no experience in coding prior to this, it's the best I can do haha. The graph with several waves on top of each other has every variable plugged into it and then there are graphs with only one of the variables for better visualization. The "Automated TQ/VEL Signal" graphs are graphing the respective signal during the first iteration of the for loop. I will also attach an excel file that has the data from the when I ran this set of contractions. You will notice that it ran it 30 times, but just the same contraction every time rather than moving through the signal in time.
Sorry again for not knowing quite how to explain these things.