03-09-2017 11:08 PM
Hello,
I am trying to find the index of two succesive values using shift registers in a while loop. The index refers to the output of the "threshold pt-by-pt VI".
But, I find that all the shift registers giving the same value.I am visualizing the values using indicators.
In future, I wish to do some arthemetic with the to succesive values of the index.
I am attaching my VI.
Can someone please find what may be the mistake I am commiting.
Thank you very much
Anupam.
Solved! Go to Solution.
03-10-2017 12:22 AM
You are looking at three values (op-1, op-2, op-3), not two. What's the purpose of op-3?
Shouldn't you only update the shift register value if the output "detected" is true or "index" actually changes?
03-10-2017 01:37 AM
I think reading op-3 is just for checking, what the index is.
Yes, I think You are right, I need to update the shift register , only when the threshold VI gives TRUE.
Should I use a Case structure to check when to update the VI for this.
Thanks
03-10-2017 06:28 AM
A case structure or a Select function should work.
03-17-2017 05:42 AM
I dont think I need a case structure or a select function. This is because the pt-by-pt threshold which I am using throws the index when the peak is detected (i.e:above threshold).
My problem is storing the 'ith' and (i-1)th index temporarily so that I can do some arthemetic and get the required. I was trying to do this using shift registers but unfortunately it did not work.
Thanks.
Any help will be of use to me.
03-17-2017 07:10 AM
My update VI.
With the Case Structure, Both of them the previous and the final still show same values.
Thanks.
03-17-2017 09:32 AM - edited 03-17-2017 09:33 AM
Your problem is that you are resetting your index when no threshold was found. Use the value currently in the shift register instead.
03-17-2017 11:01 AM
Thanks.
I constructed the VI and ran the program, the results were not as expected.
I was getting the value of heartbeat which should remain constant decreasing with every iteration.
Any hints to this problem.
P.S:Is the new logic implementation causing problems.
03-17-2017 11:05 AM
@anupam2016 wrote:
I was getting the value of heartbeat which should remain constant decreasing with every iteration.
Yeah, that makes sense. You should probably only calculate the heart rate when a threshold is detected (hint: use a case structure, and you should probably remove the Select and just put that logic in the case structure).
03-17-2017 11:16 AM
Hi,
I am posting the modified VI with the logic inside the case structure.
The results are for the values below the threshold the heartbeat gives non-zero values but decreasing.
For values above the threshold the heartbeat is infinite, meaning the the difference is zero.
Any clues?
Thank you
Anupam