LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

add graph points to an array

I've got a plot in a Waveform Graph.
In this plot I can move a cursor.
I've already gotten the cursor.position property, but how do I add this value to an array?

I want to be able to go through my graph and when I click on a button "add" , the point where the cursur is currently located is added to an array.

I've tried a while loop, in which the current cursor position is constantly updated, but is I add a case in there controlled bby a button my array keeps getting overwritten.
0 Kudos
Message 1 of 7
(3,191 Views)
Try this example. You will use the cursor index function and index your array of data points. THis will give you the value of where the cursor is located.
Hope this helps.
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
Message 2 of 7
(3,191 Views)
Thanks for the reply.

This is not the problem however, I'll try being a bit more specific.
I can get one value from the graph, that is no problem, my problem is that I want to be able to move my cursor around the graph, and every time I press a button, the current value is added to an array. This way I can quickly manually select some peaks from a range of data.

My problem is I can't get it to work. If I place an "insert into array" in a case statement, I can't loop the output to the input. I can do this in a while loop, but that way I get thousands of points in my array while I go from one point in the graph to the next.

So how can I combine these two?
0 Kudos
Message 3 of 7
(3,190 Views)
You need build an array that will hold your values; you can use a shift register to store this array. Using the build array function you can add the selected points to the array. The only thing to keep in mind is that when you press the add button the case may only be executed once. (So set the mechanical action of the Boolean to latch.)

Met vriendelijke groet / Kind regards,

Karsten
Applications Engineer
National Instruments
Message 4 of 7
(3,190 Views)
Try this example. I think what you want to use is a shift register. Hope this helps.
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
0 Kudos
Message 5 of 7
(3,190 Views)
I agree with the mechanical action. if you have it set to switch you will then be stuck in the state adding elements as fast as your loop can go. Add that functionality to your example by right clicking on the button and select properties. You will then be able to manipulate the mechanical action of the button to be a latch action. Latch being once the button is read it will return to its default state.
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
0 Kudos
Message 6 of 7
(3,190 Views)
Thanks BJD1613 and KarstenvZ.

It's working great now.

I really need to look into these shift registers.

Best regards/met vriendelijke groet,
Arend Hiddema
0 Kudos
Message 7 of 7
(3,190 Views)