09-27-2018 01:21 PM
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!
Solved! Go to Solution.
10-01-2018 09:43 AM - edited 10-01-2018 09:45 AM
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.
10-02-2018 02:05 AM
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!!
10-02-2018 03:22 AM
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)
10-02-2018 03:44 AM
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 🙂