DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

how can i create a counter for a flank detection

Solved!
Go to solution

Hello,

 

i have a signal (x-axis:time y-axis:torque) and i want to count (positve and negative flank) how often the signal (the torque) is in a given range.

My first idea was to make a event search with formals ->  (A>100) and (A<120) . After the calculation i get a result of 2. But if i want to record this for a script, the event search isn´t recorded.

All other functions will be recorded.

Is this the right procedure for such a analyse?

I´m a beginner, thank you so much!

 

 

0 Kudos
Message 1 of 5
(2,622 Views)

Hi torque18,

 

It's indeed a bit unfortunate that DIAdem does not record anything for this function. Usually, at least one line of code is being generated, which more or less allows you to run the same function again. Normally, to store the entire context of the Dialog box you need to press Ctrl + Shift + C when dialog box is opened and all the parameters are already set. Then you would see more lines of code being generated in the script. 

In case of the Event Search (Free Formula), you need to press Ctrl + Shift + C to generate the code. 

Other options you may consider are to use IIF or CTNV functions:

http://zone.ni.com/reference/en-XX/help/370858N-01/comoff/iif/

http://zone.ni.com/reference/en-XX/help/370858N-01/comoff/ctnv/ 

 

Let me know if this helps. 

M.

 

---
CLA,CTD,CLED
0 Kudos
Message 2 of 5
(2,578 Views)

hi MateuszLoska,

 

if i press the ctrl + shift + c buttons the eventstatus is generated. But the eventsamplecount (with the number of detected peaks) is not recorded. Is there any script code or function to show the number of peaks.

If i do the manual eventsearch i get a result of how many peaks there are. This number is in channel "eventsamplecount" length placed.

 

Thank you!!

Download All
0 Kudos
Message 3 of 5
(2,569 Views)
Solution
Accepted by topic author torque18

Hi,

 

It looks like  DIAdem does not record that even whenusing the shortcut. So, as a workaround you can use a script which allows you to go through each event found separately and calculate whatever you want. Please take a look at the code below. 

 

 

dim iCount,sOutPut 
ChnEventResultList = ChnEventFind("(A>52)", Array("A"), Array(Data.GetChannel("[1]/Chn")))

For iCount = 1 to ChnEventCount(ChnEventResultList)
  sOutPut = sOutPut & " Event " & iCount & ": " & ChnEventStatValueCount("[1]/Chn", ChnEventResultList, iCount)
Next
Call Msgbox(sOutPut)

Also, you can easily check the number of events found by the below function. 

ChnEventCount(ChnEventResultList)

 

 

 

---
CLA,CTD,CLED
Message 4 of 5
(2,559 Views)

hi,

 

you´re right there is no record function. Thank you very much for the detailed explanation.

That works very well !

 

Have a nice day 🙂

 

 

0 Kudos
Message 5 of 5
(2,557 Views)