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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Working with shift registers for finding index of threshold point.

Solved!
Go to solution

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.

0 Kudos
Message 1 of 17
(3,414 Views)

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?

Message 2 of 17
(3,385 Views)

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

0 Kudos
Message 3 of 17
(3,373 Views)

A case structure or a Select function should work.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 17
(3,347 Views)

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.

0 Kudos
Message 5 of 17
(3,315 Views)

My update VI.

With the Case Structure, Both of them the previous and the final still show same values.

 

Thanks.

0 Kudos
Message 6 of 17
(3,302 Views)

Your problem is that you are resetting your index when no threshold was found.  Use the value currently in the shift register instead.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 17
(3,285 Views)

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.

0 Kudos
Message 8 of 17
(3,272 Views)

@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).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 17
(3,270 Views)

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

0 Kudos
Message 10 of 17
(3,266 Views)