Showing results for 
Search instead for 
Did you mean: 

count the number of peaks of channel



I want to count the number of peaks a particular channel has above a certain limit defined by me. For example, If i define 35 as the limit, then it should give me the sum of all the occurences everytime a peak occurs with a value greater than 35.




0 Kudos
Message 1 of 6

You should be able to go to Analysis, Channel Functions, Calculate Peaks

Set your x channel, your y channel and lower limit value.


It will return two channels of data.  Position and Amplitude.  The Length of the channel is how many peaks you have.


I used 40 as my min in the example below.


dim peak

Call ChnPeakDetect("[1]/Time","[1]/Speed","/Position1","/Amplitude1","Peaks",40,3)

peak = Data.Root.ChannelGroups(4).Channels("Position1").Properties("length").Value

call MsgBoxDisp (peak, "MB_OK")



Message 2 of 6



Thanks for the reply. I have already tried this and I understand the length of the channel is the number of peaks in the channel, but how do i put that value in a table in a report? Please help!


Thanks & Regards


0 Kudos
Message 3 of 6

It depends on how you want your table to look


If you just want to add text that staes the number of peaks


Change from


dim peak




globaldim "peak"


Then in your report set up a text feild and where you want the value to show up type




and it will grab the number from your script and place it in the report.


Sorry I can't help more.  I don't use too many tables in my reports.

0 Kudos
Message 4 of 6


place 2D table to the REPORT. Then move (drag&drop) channels into tabel a set parameter of the table:

Table Definition -> Scaling -> Table length: Automatic maximum.



0 Kudos
Message 5 of 6

There is a simpler way to show the number fo peaks in your report:

  • Make sure you have a report open
  • Select the channel you created with PeakDetection in the data portal.
  • In the list of properties, there is one which indicates the length of the channel
  • Drag&Drop this property to the report
  • DIAdem will create a text which shows the length of the channel in the report

You can do this with any property from the dataportal.

If you double click teh text in the layout, a dialog will open which shows you how DIAdem created the reference to the property

0 Kudos
Message 6 of 6