From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

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

Solved!
Go to solution

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? 

0 Kudos
Message 1 of 6
(1,873 Views)

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


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,857 Views)
Solution
Accepted by topic author Ben121

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.


GCentral
0 Kudos
Message 3 of 6
(1,848 Views)

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.

0 Kudos
Message 4 of 6
(1,840 Views)

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


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(1,836 Views)

Thank you. Not I got it.

0 Kudos
Message 6 of 6
(1,828 Views)