Hi Martin,
thanks for your answer.
My solution right now is:
SudDefLoad("channels.sud")
Suddlgshow("Dlg1")
call formulacalc("ch('MyChan_left') := ch(L2)")
call databldel(cno("MyChan_Left"),1,2)
call formulacalc("ch('MyChan_mid') := ch(L2)")
call databldel(cno("MyChan_mid"),1,1)
call formulacalc("ch('MyChan_right') := ch(L2)")
Call formulacalc("ch('Mytime'):=ch(L1)")
Call DATABLDEL(cno("Mytime"),1,1)
Call DATABLDEL(cno("Mytime"),cl("mytime"),1)
ChnFormat(cno("Mytime"))=ChnFormat(L1)
call formulacalc("ch('NewResult') := ((ch('MyChan_mid') > 100 * ch('MyChan_left') and ch('Mychan_mid') > 100 * ch('MyChan_right')) or (100 * ch('MyChan_mid') < ch('MyChan_left') and 100 * ch('Mychan_mid') < ch('MyChan_right'))) * NoValue + ch('Mychan_mi
d')")
Call ChnNovHandle(ch("Mytime"), ch("NewResult"), "Delete", "XY", 1, 0)
Call ChnMove(ch("Mytime"),ChnGroup(L1))
ChnName(ch("Mytime")) = ChnName(L1) & " processed"
Call ChnMove(ch("NewResult"),ChnGroup(L2))
ChnName(ch("NewResult")) = ChnName(L2) & " processed"
ChnDel(cno("MyChan_left"))
ChnDel(cno("MyChan_mid"))
ChnDel(cno("MyChan_right"))
"channels.sud" lets you select two channels (just the standard NI solution). If you want to use this script you might have a look at some commands, because this one is written for DIAdem 9.0 Beta (I'm using a Citadel 5 database as source).
This works very well, because I have spikes of 1 datapoint width always and an interpolation is not needed for me. As all the work is done in "formulacalc" it is pretty fast...
For spikes longer than one datapoint a more flexible solution like yours is definitly needed.
Cheers,
Carsten