DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

CNo function

Hi,
 
i am trying to find a channel in the data file using the comment. What i mean is i can do something like CNo("CCargReRrAcX0o") to find the channel number based on the channel name. I want to do exactly what CNo does, just using the channel comment. I have no idea how to do this. So please help. Thanks!
 
Shefalika
0 Kudos
Message 1 of 2
(3,125 Views)

Hi shefalika,

There is no pre-built DIAdem function to do this, but you can create your own VBS function.  If you want to look at all the channels in the Portal, you would do this:

MatchChNum = MatchChnComment("Vapplied =  -100 mV")
MsgBox MatchChNum

Function MatchChnComment(MatchComment)
  Dim MatchStr
  MatchStr = LCase(Trim(MatchComment))
  FOR i = 1 TO GlobUsedChn
    IF LCase(Trim(ChnComment(i))) = MatchStr THEN Exit For
  NEXT ' i
  IF i > GlobUsedChn THEN i = 0
MatchChnComment = i
End Function ' MatchChnComment()


If instead you wanted to search only in a particular channel group (by index), you would do this:

MatchChNum = MatchChnComment(2, "Vapplied =  -100 mV")
MsgBox MatchChNum

Function MatchChnComment(GroupIdx, MatchComment)
  Dim ChNum, MatchStr
  MatchStr = LCase(Trim(MatchComment))
  FOR i = 1 TO GroupChnCount(GroupIdx)
    ChNum = CNoXGet(GroupIdx, i)
    IF LCase(Trim(ChnComment(ChNum))) = MatchStr THEN Exit For
  NEXT ' i
  IF i > GroupChnCount(GroupIdx) THEN ChNum = 0
MatchChnComment = ChNum
End Function ' MatchChnComment()

Let me know if you have additional questions,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 2
(3,107 Views)