DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Several channel smoothing

Does anybody know hou can I write a VBS-Script for smoothing several channels in the same data file ? The smoothing width is always the same, and I want the command to overwrite the existing channel, keeping the same name.
 
I am trying to use the function "Chnget" in addition to "CHNSMOOTH" but not sucessfuly yet.
 
Ps. Diadem 8.1
 
I would appreciate any hint.
 
RodrigoSmiley Very Happy
0 Kudos
Message 1 of 9
(4,745 Views)

Hello Rodrigo!

Try this:

Option Explicit
 
Dim i
 
Call ChnGet(0,1,"Smooth Channel Select")
 
For i=1 To ChnSelCount(ChnNoStr1)
  Call ChnSmooth( ChnSelGet(ChnNoStr1,i),"/Y_geglättet",12,"maxNumber")
Next
 

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 2 of 9
(4,741 Views)

Hello Matthias,

Thanks a lot for your tip, but it unfortunatelly didn't work in Diadem 8.1.

Both strings "ChnSelCount" as well as "ChnSelGet" could not be identyfied by the Script editor.

I am still looking for a solution

Have a nice weekend

Rodrigo

Sao Paulo- Brazil

 

 

0 Kudos
Message 3 of 9
(4,738 Views)

Hello Rodrigo!

Sorry! I thought the names where changed earlier and didn't tried it in 8.1.

This will work in DIAdem 8.1:

Option Explicit
 
Dim i
 
Call ChnGet(0,1,"Smooth Channel Select")
 
For i=1 To ChnStrCnt(ChnNoStr1)
  Call ChnSmooth( ChnStrRead(ChnNoStr1,i),"/Y_geglättet",12,"maxNumber")
Next

Have a nice weekend

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 4 of 9
(4,726 Views)

Hello Matthias.

Your code works this time in the 8.1 version, thanks !

However, it runs the smooth command only in the "odds" selected channels eg. 1,3,5,7,9 and skips the "even" selects channels eg. 2,4,6,8..

Also do you know any hint for the result channel overwrite the original channel name (as it is done when we call the command smoth in the taskbar) ?

I am trying to use the variable ChnSmoothIP = 1, without success so far.

Thanks a lot for your effort again !

Rodrigo

Sao Paulo - Brazil

 

0 Kudos
Message 5 of 9
(4,727 Views)

Hello Rodrigo!

Yes the DIAdem channel renaming quirks are annoying. It's a little bit improved in newer versions. Try this:

Option Explicit
 
Dim i
Dim sgChnName
 
Call ChnGet(0,1,"Smooth Channel Select")
 
For i=1 To ChnStrCnt(ChnNoStr1)
  sgChnName = ChnName(ChnStrRead(ChnNoStr1,i))
 
  Call ChnSmooth( ChnStrRead(ChnNoStr1,i),ChnStrRead(ChnNoStr1,i),12,"maxNumber")
 
  ChnName(ChnStrRead(ChnNoStr1,i)) = sgChnName
Next

In my test all selected channels are smoothed.

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 6 of 9
(4,717 Views)
Hi Rodrigo,

Please replace the line

Call ChnSmooth( ChnStrRead(ChnNoStr1,i),"/Y_geglättet",12,"maxNumber")

by the line

Call ChnSmooth( ChnStrRead(ChnNoStr1,i),ChnStrRead(ChnNoStr1,i),12,"maxNumber")

This solves both questions you have. The second parameter gives the name of the result channel. Thus you always overwrote the same channel if you used the solution above without modification.

The variable ChnSmoothIP doesn`t make sense in the script because you parametrize the result channel explicitly. Therefore ChnSmoothIP is not documented anymore in the current DIAdem version.

Hope this helps,
Ralf
0 Kudos
Message 7 of 9
(4,718 Views)
Hello Ralf!
 
As you see above you have to save the channel name and reset it after the smooth command.
 
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 8 of 9
(4,713 Views)

Hello Matthias, hello Ralf !

The code now works perfectly !!

I was almost burning my brain with it ....

Thank you very much guys.

 

RodrigoSmiley Wink

Sao Paulo - Brazil

 

0 Kudos
Message 9 of 9
(4,701 Views)