LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the old position and save it

Solved!
Go to solution

Hello everyone,

 

i attatched a simple VI  which does the following: it gives the mouse position in pixels when i click the mouse in an image.

 

My question is: I need to continuously save the last position was clicked in a variable, and then subtract the new position (when a new click occurs) from the old position. can anyone please help how to do this? 

I would be very thankful for any help 🙂 

 

Thank you in advance

0 Kudos
Message 1 of 5
(1,142 Views)

If you need to keep a record of what happened in the last iteration of a loop, you should use a shift register.  There was a really good example called Draw Graph with Events or something similar that would help you understand this.  NI took it out of the example finder though.  If I find my old copy I will post it for you.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 2 of 5
(1,131 Views)

Thank you for your reply.

 

i tried it with a shift register but somehow im not getting the result i need, which is to subtract the new value when another click occurs from the old value 😕

0 Kudos
Message 3 of 5
(1,119 Views)
Solution
Accepted by topic author AymanB95

I managed to solve it by using shift registers and saving the values to an array.

thanks again

Message 4 of 5
(1,099 Views)

Great!  Glad you figured it out.  I did find that old example.  Guess what?  It builds an array of coordinates that hold all the points in the graph just like you did.  Check it out...

 

NOTE: The example is old (2010?) but it opened in my 2019 so I saved it for that.  Let me know if you can't open it.  I used this example to start many programs where I needed to draw in an XY graph (like thermal profiles, etc.).  It's got some useful ideas in it even though it's a small program.  I don't know why NI dropped it from the examples.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 5 of 5
(1,056 Views)