From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to provide a "visual" means for a user to filter data.

I have a very smple vi written to import an excel spreadheet, choose the data in two columns and plot it out on an x y graph.  The trick y part is: the user would like to be able to view the chart and - using two markers - select the range of data he is intersted in actually saving.  Since he always wants to save the same span (a given temperature range....say 200 degrees), he would like to move either the upper or lower marker, and have the other one follow, creating a sliding range of values.  Once he positions the markers, he'd like to creat a new array, including just the values for the selected x range.  This visual technique would provide a much faster means of the user selecting meaningful data than for him to go through the raw data.  The requirements for choosing "good" data over "bad" data vary from test to test, so there's really no vible way to let LabVIEW do it mathematically.  Can this sort of thing be done?
0 Kudos
Message 1 of 7
(2,536 Views)
OK, I guess what I'm actually asking is this:  IF I could create two vertical markers that I could move along the x axis to mark the upper and lower bounds of the data I want to save, could these markers then be used to modify the original 2D array that was used to generate the xy chart in the first place, so that the new 2D array only contained the points that fell inside the range of x values set by the markers?  "I like everything between point a and point b on the x axis, so show me the array of values, whose x values fall between the markers".  The customer wants a system that can be manipulated by looking at the graph, and choosing visually, rather than having labVIEW look a the data and determine, based on some algorithm, what constitutes "noise" at the top and bottom of the plot.
0 Kudos
Message 2 of 7
(2,533 Views)
Your vertical markers would be cursors. With the Cursor Index property and the cursors locked to the plot, you can get the information needed to use the array subset information. Here's a simple example that shows how to use cursors. I didn't do the array subset and you would also need some logic to take care of the case when the user drags cursor b before cursor a.
0 Kudos
Message 3 of 7
(2,525 Views)
Dennis, thanks so much!  I'm assuming that I then take the values that are shown on the front panel (the cursor indexes), and use those to index the original array, to eliminate everything outside the markers.  Is that the approach you'd suggest?
0 Kudos
Message 4 of 7
(2,517 Views)
That's correct. As I said, the user could drag cursor b to be before cursor a so you could wire both cursor index postitions into the min/max function. Wire the min of the two positions to the index input of array subset. The length input is the max value minus the min value.
0 Kudos
Message 5 of 7
(2,517 Views)
Dennis, I really appreciate all your help.  I'm glad to see I was on the right track concerning your last post.  Now I have another question.  I want to be able to move teh cursors and position them where I want them, but then send just the last value out of the loop, to use in the Array subset function. ( I have not yet done the code to allow for someone reversing the markers, but that's straightforward).  I know this is simpler than I'm making it, but that happens with me sometimes 🙂  Can you look at theis code and tell me where I went astray?  Do I need to include the Array Subset function inside the loop with the original graph?
0 Kudos
Message 6 of 7
(2,495 Views)
Never mind...answered my own (stupid) question.  Of course, it needed to be in the loop! Now I have a second graph that reflects (on the fly) the range that I've selected with the markers on the first graph.
0 Kudos
Message 7 of 7
(2,490 Views)