LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to compare the 100th previous element value with the current using shift register ?

I am trying to find and compare every nth previous element of my data with respect to the current value. For example, I wanted to know the value of every 100th previous element  with my current value : [X(i)-X(i-100)=?]. I know that I can do that by adding more shift register elements in the loop, but having 1000 of the shift register in the loop, seems to be  not efficient. Thus, I am seeking suggestion or ideas , where instead of having to add 100 of shift register, I will have a numerical input that allows me to select the number of previous elements that i wanted to compare. 

 

thanks in advance 

 

 

 

 

0 Kudos
Message 1 of 10
(6,398 Views)

Does each iteration generate only a single value?

I suggest you to create an array with 100 elements and use this as a "ring buffer". Store the whole array in a single shift register.

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 10
(6,392 Views)
If you don't need to save all of the values you can use use the Remainder/Quotient VI to determine which values you need to test. Whenever your remainder is 0 do the comparison. When it not skip the comparison.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 10
(6,385 Views)

FBN.png

 

This is one of those times when the shift register is just not enough.  In this case You really need a feedback node.  Set it for a 100 delay and yes, you can initialize the node with an array to initialize the first 100 values.


"Should be" isn't "Is" -Jay
Message 4 of 10
(6,383 Views)

Jeff- unfortunately, I am still with LabView 8.6.1 , else that will be the solution for what I wanted to do

 

Norbert- do you have a simple example on what you suggested ? like creating 100 element in one shift register as this is similiar to the new feedback note that jeff was talking about that I am unsure how to replica it in 8.6.1

 

Mark - yes I need to store the data. I thought about that and tried it before. 

 

Thanks all..

0 Kudos
Message 5 of 10
(6,331 Views)
Even if you are storing the number you can use the approach I suggested to determine when you need to do the comparison.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 10
(6,316 Views)

This is easy. Just add 100 elements to the loop.

april fools.png

 

April Fools. Just Kidding.

 

 

I though it was funny.

Herrlin

Just trying to spread the LabVIEW love.
Message 7 of 10
(6,310 Views)

LabVIEW 8.6.1--

Best April Fools Joke EVER

 

(Could you convert this VI from LV 1.0?)


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 10
(6,281 Views)

Hi CW81,

 

100th element.png

 

I think its something along these lines you are after. The current version of data (i) is subtracted from the past 100th stored version of i. The past 100th stored version is then overwritten by the current version. This cycles indefinately. In this version, until the first 100 iterations have been stored in the array the current value of i will be subtracted from 0.

 

Hope this helps.

 

Lucither

Message Edited by Lucither on 04-02-2010 07:54 AM
------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
Message 9 of 10
(6,254 Views)

Thanks every one for all the help. I upgraded my LabView to 2009, and it has been working fine using the feedback note.

 

0 Kudos
Message 10 of 10
(6,127 Views)