07-06-2020 02:06 PM
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.
07-06-2020 02:27 PM
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!
07-06-2020 02:53 PM
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.
07-06-2020 02:59 PM
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…
07-06-2020 03:31 PM
Attached you find a sample
07-06-2020 03:49 PM - edited 07-06-2020 03:50 PM
07-06-2020 09:24 PM
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"..
07-06-2020 09:43 PM - edited 07-06-2020 11:08 PM
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!
07-16-2020 12:05 PM
Hey,
sorry for the delay.
I think thats what i have searching for, but your example is only for the x-values right?
07-17-2020 06:35 PM
@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.