DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

chnFind

Hi

I am trying to get the Chnfind function to work and have done following and want to work as shown on 1.:

I think there is something wrong with the syntax.

The Data.Root.ChannelGroups(1).Name return "BLE4_2 RxCI-SelectivityPerf BLE (1 Mbps) NOC 2402MHz PER at fixed Level"

The Data.Root.ChannelGroups(1).Channels(5).Name return "PER at fixed Level"

 

1.

This code below doesn´t work

intMyResult=ChnFind("Ch(""[" & str(Data.Root.ChannelGroups(1).Name) & "]/[" & str(Data.Root.ChannelGroups(1).Channels(5).Name) & "]"")>0")

Call msgbox ("Test2:"+str(intMyResult))

 

2.

 This code below work

intMyResult = ChnFind("Ch(""BLE4_2 RxCI-SelectivityPerf BLE (1 Mbps) NOC 2402MHz PER at fixed Level/PER at fixed Level"")>0.1",0)

Call msgbox ("Test2:"+str(intMyResult))

 

 

0 Kudos
Message 1 of 6
(3,666 Views)

Good morning,

 

In the first form you use the syntax for [groupNumber]/[ChannelNumber]

Whilst in the second one you use GroupName/ChannelName

 

Try the first one without the "[" and "]"  symbols.

 

From it:

intMyResult=ChnFind("Ch(""[" & str(Data.Root.ChannelGroups(1).Name) & "]/[" & str(Data.Root.ChannelGroups(1).Channels(5).Name) & "]"")>0")

to:

intMyResult=ChnFind("Ch(" & str(Data.Root.ChannelGroups(1).Name) & "/" & str(Data.Root.ChannelGroups(1).Channels(5).Name) & ")>0")

 

Regards,

 

Arrion

0 Kudos
Message 2 of 6
(3,663 Views)

Hi

 

Then I got an error with Expected ')'

0 Kudos
Message 3 of 6
(3,660 Views)

Hi again,

 

I tried this script and it works:

 

dim intMyResult
MsgBox( data.Root.ChannelGroups(1).Name)  'group_1
Msgbox ( str(Data.Root.ChannelGroups(1).Channels(5).Name)) 'spd_x

 

intMyResult=chnFind("Ch(""group_1/spd_x"")>0.5",0)
MsgBox intMyResult  'returns 406 -> Works

intMyResult=chnFind("Ch(group_1/spd_x)>0.5",0)
MsgBox intMyResult  'returns -1  -> Wrong, the "" are required

intMyResult=chnFind("Ch(" & Data.Root.ChannelGroups(1).Name & "/" & Data.Root.ChannelGroups(1).Channels(5).Name & ")>0.5",0)

MsgBox intMyResult 'returns -1 too. -> Wrong, the "" are required

intMyResult=chnFind("Ch(""" & Data.Root.ChannelGroups(1).Name & "/" & Data.Root.ChannelGroups(1).Channels(5).Name & """)>0.5",0)
MsgBox intMyResult 'returns 406 too. -> Works

 

It seems necessary to have the multiple " " " symbol otherwise it returned me a wrong result.

0 Kudos
Message 4 of 6
(3,657 Views)

Hi

 

Thanks now it works.

After i changed the .Channels(5) to .Channels(2) which is the same channel

 

intMyResult = ChnFind("Ch(""BLE4_2 RxCI-SelectivityPerf BLE (1 Mbps) NOC 2402MHz PER at fixed Level/PER at fixed Level"")>0.1",0)

Call msgbox ("Test1:"+str(intMyResult))

'Return 5 which is correct

 

intMyResult1=chnFind("Ch(""" & Data.Root.ChannelGroups(1).Name & "/" & Data.Root.ChannelGroups(1).Channels(2).Name & """)>0.1",0)

Call msgbox ("Test1:"+str(intMyResult))

'Return 5

0 Kudos
Message 5 of 6
(3,651 Views)

Just in case:

If you are using a new version of DIAdem (2015) then you can take advantage of the new parameters for Chnfind which allow you to use a simpler syntax

The following assumes that you have loaded the exampel data set and want to search for the first value > 35 in channel "Speed"

 

Set oChn = Data.Root.ChannelGroups(1).Channels("Speed") ' "Speed channel"
IP = ChnFind("A > 35.0",1,Array("A"),Array(oChn))
LogFileWrite("Found at position: "&IP)

0 Kudos
Message 6 of 6
(3,615 Views)