LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add values to array by clicking

Solved!
Go to solution

Well I thought of a pretty cool VI conceptually, but I can't figure out how to actually execute the code.

 

I have data that is read from a file, then graphed on an X-Y graph. I have a cursor that displays the x and y values of the current point.

I would like to do the following:

 

Have an initialized array. Then I manually move the cursor to a point of my choosing, then click a button.
That button will make the x and y value of that point append to the array. Is this possible? Or more importantly, how?

 

Thanks,
Cory

Cory K
0 Kudos
Message 1 of 23
(4,819 Views)

Almost anything is possible. Smiley Wink

 

What you're asking for is actually quite easy. To do what you want you need to respond to the graph's MouseDown event and then use the graph's Max Coordinates to XY method to get your XY pair. This method will also tell you if you clicked on a point, rather than, say, on the legend. 

Message 2 of 23
(4,813 Views)

Smercurio, in your example, what is controlling the boolean in the while loop?

It appears that I can only enter a data point once and then the loop stops. Or is that not correct?

Cory K
0 Kudos
Message 3 of 23
(4,807 Views)

There's a Stop button on the front panel, and I have a case that handles the button's Value Change event. A fairly standard way with event structures.

 

Note that the example is a crude, quick-and-dirty one just to get you started. An Issue that you would need to consider is how far away you clicked from the actual curve. The method I showed will return the nearest point, even if you clicked a point that you may consider to be "far away" from the curve, but still within the graphing area. You may, for instance, only want to add the point if you basically clicked right on the point.

0 Kudos
Message 4 of 23
(4,793 Views)

And I'm still pretty new with LabVIEW. Could you tell me where you found those properties for the graph.

I created a property node, but there are SO MANY properties, could you tell me the sub-heading under properties

where you found those.

 

Just trying to keep learning, thanks,

Cory

Cory K
0 Kudos
Message 5 of 23
(4,791 Views)

It's not a property, it's a method. Remember, I said "use the graph's Max Coordinates to XY method". Right-click on the graph and select Create-> Invoke Node -> Max Coordinates to XY.

 

Attached is the VI done in LV 8.2.

0 Kudos
Message 6 of 23
(4,781 Views)

Oh, thats probably why I couldnt find that property, because it isnt a property.

Thanks for your help.

Cory K
0 Kudos
Message 7 of 23
(4,773 Views)

When I create an invoke node --> method, I only have 5 methods to choose from,

none of which being the one you stated.

I have:

1) Attach Data Socket

2) Get Image

3) Get Term Image

4) Reinit to Drift

5) Remove Data Socker

 

Am I still doing something wrong?

 

(I can't open your VI because I am running 7.1)

Cory K
0 Kudos
Message 8 of 23
(4,765 Views)

Since this topic in specific is pretty new to me, does anyone know of anywhere off hand I could learn about 'Methods'.

Like a hyperlink to some NI article or some forum thread or something?

I am self-taught at LabVIEW, so I try to pursue a topic if I don't know it too well.

 

Thanks

Cory K
0 Kudos
Message 9 of 23
(4,759 Views)
Am I doing something wrong here? I can add the x and y value of the cursor once, then it just holds those values and wont let me do anything else?Append to Array
Message Edited by Cory K on 10-10-2008 03:58 PM
Cory K
0 Kudos
Message 10 of 23
(4,750 Views)