DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract y values according to x axis?

Hi,

 

i'm using DIADem 2012.

 

I have 2d curve chart with timeStamp represented by the x axis and 3 others channels on the Y axis.

 

How could i extract the x,y,z current values according to the current timeStamp,

for example: the timestamp 23/01/2013 05:45:56.2560 should give me the x(2)y(23)z(56).

 

So far i just could extract the x and y values by: View.CurrSheet.Cursor.X1/Y1

 

Thanks

0 Kudos
Message 1 of 12
(9,110 Views)

Just to confirm that I understand your setup, you have 3 different curves (x, y, and z values) along the y axis plotted against a timestamp on the x-axis? Can you provide some additional information on your application such as why you are extracting the values based on the timestamp and how you plan to use them? Do you want to extract all 3 values at once?

Regards,

Anjelica W.
National Instruments
Product Marketing Manager
FlexLogger and TestStand
0 Kudos
Message 2 of 12
(9,077 Views)

Hi OzShimon,

 

You will need to use the time cursor position to look up the X, Y, Z values from the Time channel, X channel, the Y channel, and the Z channel themselves.  First find the row number that corresponds to that cursor position in the Time channel, then look up the X, Y, and Z values with that row number using their channels.

 

Set Group = Data.Root.ActiveChannelGroup
Set TChannel =  Group.Channels("Time")
Set XChannel =  Group.Channels("CH1")
Set YChannel =  Group.Channels("CH2")
Set ZChannel =  Group.Channels("CH3")
TimeCursor = View.ActiveSheet.Cursor.X1
Row = PNo(TChannel, TimeCursor)
Xvalue = XChannel.Values(Row)
Yvalue = YChannel.Values(Row)
Zvalue = ZChannel.Values(Row)
MsgBox Row & vbCRLF & TimeCursor & vbCRLF & Xvalue & vbCRLF & Yvalue & vbCRLF & Zvalue

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 3 of 12
(9,073 Views)

Hi,

 

I know this is an old post, but is it possible to feed multiple channels in a single command and get the respective y axis values at a constant time axis?

 

ie, In the above script, multiple statements are required to set the channels and get the values. But instead can we perform it in a single statement?

 

Note: Time axis in X axis will remain the same.

Certified LabVIEW Architect
System Test Architect
Electrical Engineering
JLR
0 Kudos
Message 4 of 12
(5,394 Views)

Hi Rishi,

 

I think the short answer is, "No, it is still required to send a series of commands, one for each curve you're looking up the Y value from".  The original post here talks about a 3D graph based on parallel X, Y, Z channels.  You sound like maybe you're talking about a 2D graph with multiple curves, where you want to receive all the Y values back in an array based on the X value you provide.  I don't want to give you hope here, I don't think it will change the answer, but I do want to make sure I understand your use case.  In the meantime DIAdem has added a function that you can use to retrieve the 3D surface value, but I have never personally used it.  What I do know for sure is that it would not help with a 2D graph.

 

Brad Turpin

Principal Technical Support Engineer

NI

0 Kudos
Message 5 of 12
(5,383 Views)

Hi Brad,

 

Thanks for the reply. I have achieved this by setting TChannel as timestamp channel and writing multiple statements for each channel. I had to write Xvalue statements for all channels. 

 

View.ActiveSheet.Cursor.X1 = <time in msec>
TimeCursor = View.ActiveSheet.Cursor.X1
Row = PNo(TChannel, TimeCursor)
X1value = X1Channel.Values(Row)

X2value = X2Channel.Values(Row)

Certified LabVIEW Architect
System Test Architect
Electrical Engineering
JLR
0 Kudos
Message 6 of 12
(5,263 Views)

It looks like I have a similar question and would appear that I will need to setup a script for this.  However, I am confused as to why Diadem would have this issue.  Running Diadem Q4 2022.

I have X1/Y1, X2/Y2, X3/Y3, X4/Y4 coming from 4 different datasets each with unique x and y values.  When I go to "Curve Cursor" and set the X-axis to say "2.5" I would expect the Legend to show the Y values for the X value at 2.5 for all lines of all 4 datasets.  However, what it seems to do, is add extra "X" crosshairs for the other curves and gives whatever X value it feels like and the corresponding Y value for the random x-value that it selected. 

Is the only way around this to create a script that asks for a X value input for all 4 datasets and let that spit out the corresponding Y value for each dataset?  I tried playing with the settings under "Cursor" but they don't seem to change its behavior.

 

Since the multiple crosshairs are hard to see, I drew manual ones exaggerated just to show what it seems to be doing.  I want it to show the Y value for each dataset for exactly 2.5 or 2.0 or wherever my x-value cursor is currently located.  Not the Y-value for a random X-value that is close to my selected curve's x value.  It 'works' for the selected curve and tries to work for the other curves but instead of the X-value being consistent it selects an x-value that is close and reports the corresponding Y for that random X.

Ian0828_0-1684186682820.png

 

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

Hello.

Your expectation seems to be correct for me; you expect to see the Y-value that corresponds to the defined X value.

Without knowledge of your data, I guess that the behavior you see can be seen if you don't have exact the same X value for all channels you plot.

Please check (e.g. in a list view of the channels), if all data sets you use as X reference actually have the value 2.5. I guess, they have not. Then the only one thing the code can do, is to use the mostly close values to plot...

 

Even if it doesn't solve your problem, it could give you the reason, and therefore show the way to solve.

 

Greetings,

Vassili

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

Thanks for the reply.  What is strange, is there are plenty of datapoints.  But for some reason, when you move the cursor following a line, it picks up X-Axis points on the other lines, they just don't match the X-Axis value of where the cursor currently is.  So if I was looking for the Y-values corresponding to 0.6 x-axis in this example, I can't see the corresponding y-values for 0.6 x-value for all lines because Diadem seems to be grabbing x-values that are 'close' but not 0.6.  The arrows show the X-value that Diadem is grabbing randomly for the Green and Blue lines that aren't even close to 0.60.

 

Ian0828_0-1685483808976.png

 

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

Hello Ian0828,
have you tried this setting?

 

DIAdemo_0-1685627962493.png

 

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