Showing results for 
Search instead for 
Did you mean: 

name of channel

Go to solution

Hey Brad, Sorry for uploading incomplete data, there was an error each time i tried to upload, I have sent Feedback to NI for this Problem. Attached below is the complete data including Vbs

0 Kudos
Message 11 of 18

Hi Ali,


I'm sorry, that's still not the right file.  I now have a "Dauerlauf" TDM file and a "Zyklisch" TDX file.  I either need a TDM/TDX pair for "Dauerlauf" or a TDM/TDX pair for "Zyklisch".


There are file name references in the TDM file that point to a particular TDX file, and there could be differences in how the data is structured between the two.  It's better to just get the correct TDM/TDX file pair than to try to whittle on a TDM file to make it fit a TDX file it wasn't written for.


Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 12 of 18

Hi Ali,


Sorry, I missed the pagination.  I saw your correct ZIP file on page 2 and was able to load your "Dauerlauf" data set.  Let's start with finding all the "p_S*" sensors in Group 1.  The easiest way would look like this:


Set pChannels = Data.GetChannels("[1]/p_S*")
pMax = pChannels.Count
FOR p = 1 TO pMax
  LogFileWrite pChannels(p).Name
NEXT ' p
LogFileWrite pMax & " p_S* channels"

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 13 of 18

Hi Brad,


Thank you. And what to do if one of the channel for a sensor is missing in a particular file? How would I calculate the 'Gesamt' or total at the end for all of them?



0 Kudos
Message 14 of 18

Hi ali,


Do you mean that you want to read off the last value for each of these channels?  Or do you mean that you want to sum up the values of each of these channels?  Or do you want to combine the values of these channels in some way to end up with a total value?


What part of the process are you struggling with?  Is it looping over the channels or running your calculation for different numbers of present channels, or what?  The loop I last sent you already loops over all such channels present.  What is the difficulty introduced by some files having more or fewer of such channels?


Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 15 of 18

Hey Brad,


Thank you for your reply. You can look at this by deleting one of the channels in any of the files and then try to run the code. The Problem is, that each files contains the readings of the same sensors over a period of time.

For example

File 1   24 sensors

File 2   24 sensors


In some cases the sensors stop functioning and hence there is no corresponding channel for them for that particular time in the respective file. In such cases, either the code does not run or if it does the wrong values get 'added' on the channel. For example the 12th sensor of file 1 may get added to the 13th sensor of file 2 if the 12th sensor of file 2 is missing. So how do I skip the Iteration?

0 Kudos
Message 16 of 18

Hey brad,


Could u pls reply?



0 Kudos
Message 17 of 18

Hey ali,


Sorry for the slow reply.  It sounds like you want to concatenate by channel name, not channel index, but also skip the right number of lines when a channel is missing in a particular group.  Here's a script that should do that.  It assumes that all the channels are present in the first group.


Dim i, iMax, Groups, ConcatChannel, Channel, Size
Set Groups = Data.Root.ChannelGroups
iMax = Groups.Count
FOR Each ConcatChannel In Groups(1).Channels
  FOR i = 2 TO iMax
    Size = Groups(i).Channels(1).Size
    IF Groups(i).Channels.Exists(ConcatChannel.Name) THEN
      Set Channel = Groups(i).Channels(ConcatChannel.Name)
      Set Channel = Groups(i).Channels.Add(ConcatChannel.Name, ConcatChannel.DataType, i+1)
      Call ChnLinGen(Channel, Null, Null, Size)
    END IF
    Call ChnConcat(Channel, ConcatChannel)
  NEXT ' i, Group(i)
NEXT ' ConcatChannel


Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 18 of 18