LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cursor and Graph

Hi all,

 

i have a question about the cursors in a graph.

 

I want to set two cursor positions in a plot to calculate the mean or other values between them.

 

My question is, will build the mean only of the two values of the cursor position (as an example Y1 and Y2) himself or will he use all values in between too for the calculation.

 

I know it will be a fundamental question but i'm not sure about the calculation.

0 Kudos
Message 1 of 12
(2,798 Views)

Hi DMego,

 


@DDsaaD wrote:

My question is, will build the mean only of the two values of the cursor position (as an example Y1 and Y2) himself or will he use all values in between too for the calculation.


The cursors are just cursors. "They" will not do any calculation on their own.

It's up to you to define the requirements and to implement the needed algorithm!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(2,792 Views)

Ok my description was too vague apparently.

Maybe I will try it like this, I would like to calculate with all values between two cursor positions, the calculations themselves are not the problem.

My problem is how to extract the data (single values) from a part of a curve between these two positions (into an array) to calculate with them.

0 Kudos
Message 3 of 12
(2,774 Views)

Hi DMego,

 


@DDsaaD wrote:

I would like to calculate with all values between two cursor positions, the calculations themselves are not the problem.

My problem is how to extract the data (single values) from a part of a curve between these two positions (into an array) to calculate with them.


The cursors will give you a X coordinate. Use it to determine the subarray of the needed data.

 

It would help much more when you would provide an example VI with example data. Set two cursors in the graph and tell us the expected result…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 12
(2,767 Views)

Attached you find a sample

0 Kudos
Message 5 of 12
(2,757 Views)

Hi DMego,

 

like this:

Generic advice: using ExpressVIs and DDT wires will hide the underlying data from view. Most often it is easier (in the end) not to use ExpressVIs…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 12
(2,732 Views)

Use cursors that are locked to a plot, the user the "cursor.index" propert. It will give you the index of array element under the cursors. Now you can use subset with start="smaller index" and size="larger index - smaller index +1"..

0 Kudos
Message 7 of 12
(2,698 Views)

Here's what I had in mind. Note that "cursor position x" needs to be scaled if x0 and dx and not at the default to calculate the correct index. "Cursor.index" always points to the right element!

 

altenbach_0-1594089727160.png

 

0 Kudos
Message 8 of 12
(2,695 Views)

Hey,

 

sorry for the delay.

 

I think thats what i have searching for, but your example is only for the x-values right?

 

 

0 Kudos
Message 9 of 12
(2,638 Views)

@DDsaaD wrote:

 

I think thats what i have searching for, but your example is only for the x-values right?


Yes, because you said "I want to set two cursor positions in a plot to calculate the mean or other values between them." and you did not mention xy graphs. Graphs typically contain arrays and only the index is an independent variable.

 

What do you need Y for? Clip the data to a Y range too?

Please explain exactly what you want to do, maybe with a picture.

0 Kudos
Message 10 of 12
(2,606 Views)