02-16-2013 02:49 PM - edited 02-16-2013 02:50 PM
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
02-18-2013 04:55 PM
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?
02-18-2013 05:19 PM
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
05-22-2021 05:39 AM
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.
05-24-2021 04:28 PM
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
06-01-2021 07:25 AM
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)
05-15-2023 04:42 PM
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.
05-23-2023 12:58 AM
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
05-30-2023 04:58 PM
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.
06-01-2023 09:00 AM
Hello Ian0828,
have you tried this setting?