LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PLACE CURSOR X WHERE Y = VARIABLE

Solved!
Go to solution

 

 

Hello All.

 

 

I am having a bit of a problem placing the a cursor on X where Y = Variable (Changes depending on user inputs)

 

I am doing this right now by looping through Data and see if current Y = desired Y location. I feel that this way is too slow and without wait period takes too much memory.

 

It works fine with my simulated data but I don't think it will work well with a large number of samples.

 

Can anyone tell me how to tell a cursor to go to where Y = myVariable?

 

Attached is my current VI with simulated data.

 

Thanks

 

I was not able to attached the simulated data files

 

 

 

 

JCollado
0 Kudos
Message 1 of 9
(3,742 Views)

 

 

Just to clarify.

 

I know how to use the property node to do this on FREE cursors but I cant get free cursors to go to my signal location.

 

Single plot cursors automatically follow my signal but I wish the single plot cursor would automatically move X to where it intersects Y at my desired location.

 

I hope this makes sense.

 

JCollado
0 Kudos
Message 2 of 9
(3,735 Views)

Hi JCollado,

 

 

Sorry i was unable to open your file as i am using lv 8.6.

 

But if i have understood you correctly the following should be helpful.

 

just create cursor (single plot).

 

regards,

 

Shrek

0 Kudos
Message 3 of 9
(3,731 Views)
sorry i didnt read your second msg.
0 Kudos
Message 4 of 9
(3,729 Views)

Your question is quite ambiguous, because there could be many locations that match the criterium. Only if the data is monotonically increasing or decreasing, there will be one unique solution.

 

Without seing some data, it's difficult to tell what you actually want. Typically, a "threshold array" on the array data will give you the first positions where the y corresponds to the input.

 

Anyway, your code is way too complicated for what it's doing. You can probably eliminate 80% of the property nodes. Many can be combined into one and used for read and write at the same time. You might also learn about shift registers.

 

Can you attach a datafile and tell us what location you want the cursor to go?

Message 5 of 9
(3,710 Views)

Your current code hurt my brain, but if you want to do something quick and dirty I would subtract the target Y from the data, take the absolute value and search for the minimum.  Use the index of the minimum to set the cursor.  You may get craziness with multiple values, but I would cross one bridge at a time.

 

I would use an event structure and free cursor myself.  Trigger an event on the cursor release, and use the Y-value as the target.

0 Kudos
Message 6 of 9
(3,707 Views)

 

 

Ok all thanks for your replies.

 

Sorry about my bad coding. This is my first VI and I don't really have a good grasp on labview yet. I will look into shift registers too since I may not understand their power well yet.

 

 

Attached is my VI with constant arrays for data simulation that way you can see what is doing now. I want to do the same thing without using so much resources. The real data will have many  more data points.

 

JCollado
0 Kudos
Message 7 of 9
(3,694 Views)
Solution
Accepted by JCollado

Here's a very quick draft to get you started. I'm sure it needs a few tweaks... 😉

 

Message 8 of 9
(3,670 Views)

Thank you altenbach

 

This only looks a million times better!Smiley Very Happy

 

I can can only hope to get better and be able to make more sense of everything.

 

Most of my programming skills are only vb.net database programming.

 

Thanks all

JCollado
0 Kudos
Message 9 of 9
(3,665 Views)