DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

ChnSmooth doesent create channel

Hello everyone,

 

I hope you can help me with my little Problem, the humongous ammount of helpfull topics I've found so far let me hope.

 

I try to filter some channels by mean and afterwards median. I tried to be efficent/lazy and save a few lines of code.

 

At 1st I filter my origin channel, afterwards remove the original channel and at last I filter the already filtered channel and want to have a new channel with the name of the original channel.

Sub FilterMedianMean(ByVal FilterKanal,ByVal SampleLaenge)
...
KanalName = FilterKanal.Name
...
Call ChnSmooth(FilterKanal,KanalName+"-Filter-Mean",SampleLaenge,"maxNumber","byMeanValue")
Call oKanaele.Remove(KanalName) Call ChnSmooth(KanalName+"-Filter-Mean",KanalName,SampleLaenge,"maxNumber","byMedian")

 But the 2nd channel never gets created.

 

I have no Idea why I can't do it this way. Of course I could change the code and delete the original channel afterwards and just rename the result channel but right now i'm just currious.

0 Kudos
Message 1 of 3
(2,123 Views)
Call ChnSmooth("Group/Channel1","Group/Channel3",10,"maxNumber")

This is the example provided in the docs.  My guess is since you don't specify a group for the resulting channel, it drops the result in the active group.  The other thing could be the mix of variable types?  In the first smoothing you provide a channel as the 1st argument and in the second smoothing you provide a string?  I'd do:

Call ChnSmooth(FilterKanal.GetReference(eRefTypeNameName),FilterKanal.GetReference(eRefTypeNameName)+"-Filter-Mean",SampleLaenge,"maxNumber","byMeanValue")
Dim FilteredKanal
Set FilteredKanal = FilterKanal.ChannelGroup.Channels(KanalName & "-Filter-Mean")
Call oKanaele.Remove(KanalName)
Call ChnSmooth(FilteredKanal.GetReference(eRefTypeNameName),FilteredKanal.GetReference(eRefTypeNameName),SampleLaenge,"maxNumber","byMedian") 
0 Kudos
Message 2 of 3
(2,109 Views)

Thanks for your ideas but IMHO its non of your suggegtions.

 

You are right and I didn't mention it, but the script activates every group bevor any changes are made into this group. So the Result should be placed in the right group.

 

For the 2nd suggegstion, you are a little off. The 1st argument gets the object reference which is just a string in the form of "Group name/Channel name" so the 2nd argument is just the same string with some apendix. This is for your case and my soultion but I just get the Name like "Channel name" without group because of the active group it isn't needed, so i thougth. And it works for the 1st chnsmooth.

 

I still guess is has something to do with the deletion of the reference Channel or so. As a solution I just changed the order and delete orginal channel after creating the second filterd channel and it works fine.

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