DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

ChnListBox... of another TDMS File

Solved!
Go to solution

Hi everyone,

 

I would like to plot a waveform channel, given any x-value channel and any y-value channel, that I choose in a dialog box.

This is quite easy if the two channels belong to the same TDMS file, as you can see in the code below (works on my computer):

 

Option Explicit  'Forces the explicit declaration of all the variables in a script.
Dim DisplaySheet, DisplayArea, oMyCurve

Call UserVarCompile("WaveformPlot.VAS")
Call SUDDlgShow("Dlg1","C:\Documents and Settings\All Users\Documents\National Instruments\DIAdem 11.0\Documents\WaveformPlot.SUD", NULL)

Call View.Sheets.RemoveAll
Dim oMySheet: Set oMySheet = View.Sheets.Add("Sheet 1")
View.ActiveSheet.Cursor.Type = "Curve"
Set DisplaySheet = View.Sheets("Sheet 1")

Set DisplayArea = DisplaySheet.Areas.Item(1)
DisplayArea.DisplayObjType = "CurveChart2D" 
Call View.Sheets("Sheet 1").Areas.Item(1).DisplayObj.Curves.RemoveAll
Set oMyCurve = DisplayArea.DisplayObj.Curves.Add(XChannel_, YChannel_)

 I created two user variables named XChannel_ and YChannel_ so that I can use them in my SUD file.

Everything is perfect... but I am asked to select channels from any TDMS file. The two chosen channels may not belong to the same TDMS file.

I do not know how to handle this as I do not think there is a command that would let me use 1 channel of 1 TDMS file without loading it fully. In the help I could see several methods like ChnNameGet with DataFileHeader but none of them really deal with my problem.

I hope someone will help me.

Thank you.

 

0 Kudos
Message 1 of 3
(5,538 Views)
Solution
Accepted by topic author Near3

Hi Near,

 

Let me first address the selective channel loading component of your post.  If you also want help passing all required information from the SUDialog back to the DIAdem VBScript, we can tackle that next.  For loading a single channel from a data file, you must know the following information:

 

Full file path to the data file (drive + folder + name + extension)

Name of the DataPlugin to use to read this data file

Name or Index of the channel group the channel is in

Name or Index of the channel to load

 

GroupRef = "GroupName" ' OR "[1]"
ChannelRef = "ChannelName" ' OR "[2]"
ChannelPath = GroupRef & "/" & ChannelRef ' "GroupName/ChannelName" OR "[1]/[2]"
Call DataFileLoadSel(DataFilePath, ChannelPath, DataPlugin)

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 2 of 3
(5,516 Views)

Hi Brad,

thank you very much for your help, everything works great now ! 🙂 

I have done the Dialog Box part myself and am passing all useful information through user variables.

Thanks again.

0 Kudos
Message 3 of 3
(5,489 Views)