DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Optimum method to compute the number of times that a value exceeds a threshold in a channel

Hi All,

 

For example I may have a channel which is 1000000 elements long in which there are 5 occurrences where where the threshold exceeds the target. I'm currently solving it like this:

 

Count = 0

 

For Length_Counter = 1 To ChnPropValGet("[1]/MyChannel", "length") 


 Cur_Val = CHV(Length_Counter,"[1]/MyChannel")
 
 If Cur_Val >= Threshold Then
  Count = Count + 1
 End If

 

 Next

 

Obviously if the length of the channel is very large this method can take a considerable amount of time to compute an answer. Does anybody know of a more efficient method to achieve the same result? I was hoping that DIAdem would have contained a built in function which I could use but I have yet to find it.

 

Thanks a lot for looking and I look forward to any responses.

 

Matthew

 

0 Kudos
Message 1 of 3
(3,518 Views)

Ok, In case anybody is interested my new solution to this problem is as follows:

 

Call Calculate("Ch(""[1]/TempMyChannel"") = Ch(""[1]/TempMyChannel"") + CTNV(Ch(""[1]/TempMyChannel"")<5)")
Call ChnNovHandle("[1]/TempMyChannel","[1]/TempMyChannel","Delete","X",1,1,0)

Count = ChnPropValGet("[1]/TempMyChannel", "length")

Data.Root.ChannelGroups(1).Channels.Remove("TempMyChannel")

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

Should be:

 

Call Calculate("Ch(""[1]/TempMyChannel"") = Ch(""[1]/MyChannel"") + CTNV(Ch(""[1]/MyChannel"")<5)")
Call ChnNovHandle("[1]/TempMyChannel","[1]/MyChannel","Delete","X",1,1,0)

Count = ChnPropValGet("[1]/TempMyChannel", "length")

Data.Root.ChannelGroups(1).Channels.Remove("TempMyChannel")

0 Kudos
Message 3 of 3
(3,516 Views)