DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

For each element of an ElementList: is there an index?

Hello

I want to repeatedly run a calculation over 2 channels of many groups, such as

ChnMapLinCalc("[i]/chan A","[i]/chan B,.... )"

and the like, which take 2 input channels

 

Now this could be done quite efficiently using lists, e.g.

Set oXList = data.getchannels("*/chan A")

Set oYList = data.getchannels("*/chan B")

and run

for each oXCh in oXlist

Set oYch = oYList( index of oCh in oXList )

       Call ChnMapLinCalc(oXCh, oYCh)

next

 

However, I cannot find a way to retrieve which index in oXList my loop is at.

(Apart from some workarounds with loop variables like i=0: i=i+1. in which case I could just as well discard the ElementList- elegance.

OTOH, there must be some type of internal pointer to the list element.

 

Thank you for suggestions.

 

Michael

 

 

 

 

0 Kudos
Message 1 of 2
(2,256 Views)

You can just loop by index instead of using for each

Option Explicit

Dim oMyChns: Set oMyChns = Data.GetChannels("T*")
dim i : for i = 1 to oMyChns.Count
  LogFileWrite(oMyChns(i).name)
Next
0 Kudos
Message 2 of 2
(2,242 Views)