02-09-2012 07:43 AM
Hi,
I am looking for a simple solution in order to plot selected values from a channel in a 2D curve. Currently my coding looks like this:
' Create new curve object
Call GraphObjOpen("New_Curve" & count)
'Opens the curve object
D2CChnX = "iCentralTmpFileDummy/" & "Date"
D2CChnY = "iCentralTmpFileDummy/"& element
CallGraphObjClose("New_Curve" & count)
This would plot channel "element" vs. channel "Date".
What I need is to plot e.g. "element(1 2 6)" vs. "Date(1 2 6)". Is there a Matlab/ Python style solution for that, i.e. direct indexing?
Can anybody help?
Thanks,
Daniel
02-10-2012 08:50 AM
Hi Daniel,
Do I understand you correctly that you have channel pairs named "Date" and "element" in each of three channel groups, where the channel group indices are 1, 2, and 6 respectively? If so, are there "Date" and "element" channel pairs in any other channel groups that you don't want to plot?
The easiest way to do this would be to use "Curve Expansion", but that will automatically plot all "Date" and "element" channel pairs from ALL channel groups, so if you want to exclude some "Date" and "element" channel pairs from some channel groups, this won't work.
The alternative is to create a separate curve for each desired "Date" and "element" channel pair, and here you can use the channel group index in the channel reference, if you prefer:
Call GraphObjOpen("New_Curve" & count)
D2CChnX = "[" & count & "]/" & "Date"
D2CChnY = "[" & count & "]/" & element
CallGraphObjClose("New_Curve" & count)
Note that your channel references above use the older channel number-oriented referencing variables. At some point you may run across the newer channel name-oriented referencing variables, which look like this:
PicDefByIdent= 1 ' Channel Name-Oriented channel referencing
Call GraphObjOpen("New_Curve" & count)
D2CChnXName = "[" & count & "]/" & "Date"
D2CChnYName = "[" & count & "]/" & element
CallGraphObjClose("New_Curve" & count)
This is admittedly confusing, because the channel number-oriented variables will accept channel names and implicitly convert them to the corresponding channel numbers. If you use the channel name-oriented referencing, you will see that you can type the "[1]/Date" channel reference directly into the REPORT object configuration dialog. The channel number-oriented referencing will limit you to selecting from a drop-list of all channels.
Let me know if you want more info on "Curve Expansion",
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-10-2012 10:47 AM
Hi Brad,
thanks for the reply!
Anyway, I am bit puzzeled now most likely since I have some troubles with the DIAdem terminology distinguishing between "group" and "channel". In my example I have one data set with various channels, which has been imported to the DIAdem workspace via
Call DataFileImport("C:\WINNT\Temp\iCentralTmpFileDummy.dat", "DAT_DataPlugin123")
The data set contains two channels "Date" and "element". For illustration of this data it is necessary to split each channel in several chunks, since the underlying measurement process created successive data from different measurement types:
-> element(1, 6, 11, ...) belongs to measurement type 1 and goes to plot 1
-> element(2, 7, 12, ...) belongs to measurement type 2 and goes to plot 2
-> element(3, 8, 13, ...) belongs to measurement type 3 and goes to plot 3
-> etc.
(Please note the repeating pattern)
For example in Matlab, an easy command for this purpose would be:
figure
plot(Date(1:5:20), element(1:5:20)
figure
plot(Date(2:5:20), element(2:5:20) etc.
So, I'd like to assign channels to D2CChnXName and D2CChnYName, but only partly!
Is this explanation and my objective understandable?
Thanks and Regards,
Daniel
02-10-2012 12:48 PM
Hi Daniel,
You're right, I don't understand your terminology either. Let's start with your use of the word "element". Do you mean a single value from a a 1D array of values? Or do you mean a particular 1D array of values?
How many curves do you expect in your desired graph? How many data points do you expect in each curve?
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-13-2012 10:34 AM
Hi Brad,
sorry for the bad explanation.
Ok...
I have a data set, which contains some channel "abc". This channel contains n measurement values, i.e.
abc=[M1 M2 M3 M4 M5...Mn].
Then I wand to plot for example M1, M3, M5, ... (odd indices) in the first plot and M2, M4, M6,... (even indices) in another plot. Each plot should only carry one curve.
How can I split the data accordingly?
Thanks,
Daniel