LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

every value subtract of last value

Solved!
Go to solution

Hei

 

Anybody know how to do, on loop or while loop.., I need that constant or control number 300 would b subtract for constant number.., but I mean for example 300-2=298-2=296-2 and so on,subtract of the last value.

 

Thanks

 

0 Kudos
Message 1 of 24
(3,983 Views)

Read up on Shift Registers and For Loops and you should be able to get there.

0 Kudos
Message 2 of 24
(3,977 Views)

I have checked, but dont understand... may help?

0 Kudos
Message 3 of 24
(3,965 Views)
Solution
Accepted by topic author JohnP2356

Read the help on shift registers again.  Take some tutorials.
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

 

Shift registers take a value at the end of one loop iteration, and return it to the beginning of the next loop iteration.

Message 4 of 24
(3,958 Views)

Can you explain which part you don't understand?

There is an example in the LabVIEW help that does exactly what you want except with addition and multiplication.

Look in the LabVIEW help for Shift Registers: Passing Values between Loop Iterations.

0 Kudos
Message 5 of 24
(3,955 Views)

Thanks., I dont understand that my number 300 should be subtract from line of shift register?

 

 

0 Kudos
Message 6 of 24
(3,948 Views)

subtract 2 from that number.  Put the result in the shift register.  You start with 300 by intializing the shift register with that value.

0 Kudos
Message 7 of 24
(3,939 Views)

I should do this?

0 Kudos
Message 8 of 24
(3,931 Views)

Almost.

 

Wire the constant 300 into the left hand shift register.

 

Then it is a question of how many times do you want the loop to run.  Do you want it to run 300 times?  (It would eventually get to -300.)  Do you want to stop it at zero?  Or something else?

 

And your subtracting is backwards.  You said you wanted to subtract 2.

0 Kudos
Message 9 of 24
(3,927 Views)

I did, but not get that every loop show the last value when it has been subtract from 2. I need run 300 times. Yes, stop at zero.

0 Kudos
Message 10 of 24
(3,917 Views)