# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution
Highlighted

## How to input X value at which Y is minimum (of xy graph) in a waveform graph

Hello!

I am at a beginner's level of LabView programming. I have a small doubt if anyone can help me out with this.

Actually, in an XY graph, I want to have the X value at which Y is minimum (which is changing continuously while running the program continuously) and feed this X value (at Y minimum) as an input to a different waveform graph. Basically I want to see the variation of X value at Y minimum with time in live mode.

Can someone please suggest me how to find the X value at Y minimum of one graph and feed it in other graph at once?

Message 1 of 6
(140 Views)
Highlighted

## Re: How to input X value at which Y is minimum (of xy graph) in a waveform graph

Hi pragya,

@Ben121 wrote:

Actually, in an XY graph, I want to have the X value at which Y is minimum (which is changing continuously while running the program continuously) and feed this X value (at Y minimum) as an input to a different waveform graph. Basically I want to see the variation of X value at Y minimum with time in live mode.

When you have a XY graph then you also have an array of X values and an array of Y values.

Now you are asking how to get the minimum from that Y value array? There's a ArrayMinMax function in the array function palette…

Now you just need to build another array from those minimum data to create a plot for your "different waveform graph"!

Best regards,
GerdW
CLAD expired, using LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome

Message 2 of 6
(124 Views)
Highlighted
Solution
Accepted by topic author Ben121

## Re: How to input X value at which Y is minimum (of xy graph) in a waveform graph

Hi,

As GerdW said, there's an Array Max and Min function which in addition to finding the min+max values, also provides their indices.

You can then use this value to Index Array for your X values.

Use a Shift Register if needed to store previous "time" values, or display using a chart (charts store history - graphs do not).

If your data (in the XY graph) is stored as an array of points (or array of clusters of arrays of points, for multiple plots) then you won't be able to directly use the Array Max + Min function, but you could implement the same functionality in a point-by-point manner using a For loop. If you have control of your data input, it would be better to keep separate X and Y arrays for this reason (and plot the cluster of arrays of X and Y option, instead of the points). See the "Detailed Help" for an XY Graph for more details.

Message 3 of 6
(115 Views)
Highlighted

## Re: How to input X value at which Y is minimum (of xy graph) in a waveform graph

Thank you for the responses.

Actually, instead of Y minimum values, I want the X values for which Y is minimum i.e., the value of X (at minimum value of Y). I want to use the X value (at which Y is minimum) for the waveform graph.

Message 4 of 6
(107 Views)
Highlighted

## Re: How to input X value at which Y is minimum (of xy graph) in a waveform graph

Hi pragya,

did you read the (context) help for ArrayMinMax and cbutchers excellent message?

Why don't you use the min index to solve your requirements?

Best regards,
GerdW
CLAD expired, using LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome

Message 5 of 6
(103 Views)
Highlighted

## Re: How to input X value at which Y is minimum (of xy graph) in a waveform graph

Thank you. Not I got it.

Message 6 of 6
(95 Views)