DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to call a channel length in a calculation instead of a fixed value

Solved!
Go to solution

Hi there,

 

I am fairly new to DIAdem scripting and I know this is probably fairly basic but I cant get it to work. 

 

I am trying run a calculation but firstly I am creating a channel which is a copy of another channel:

 

Call Data.Root.ChannelGroups(1).Channels.Add("NaN",DataTypeString,11)
Call DataBlClpCopy("[1]/esc_index",1,19191)
Call DataBlClpPaste("[1]/NaN",1,0,1)
Data.Root.ChannelGroups(1).Channels("esc_index1").Name = "NaN"

 

While doing this by recording, it automatically detects the length of "esc_index" channel to be '19191' but I want this to work for different sized files not just this specific one.

 

Also as an additional question, when I create the NaN channel, and copy the values from esc_index to it, it automatically renames the channel to "esc_index1", so I have to run another line just to rename it back, is there a way to avoid this?

0 Kudos
Message 1 of 3
(2,175 Views)
Solution
Accepted by topic author petros127

Hello petros127,

 

This script code answers both questions:

dim oChnNew, oChnSource
set oChnSource = Data.Root.ChannelGroups(1).Channels("esc_index")
set oChnNew    = Data.Root.ChannelGroups(1).Channels.Add("NaN", DataTypeString, 11)
call oChnNew.SetValuesBlock(oChnSource.GetValuesBlock)

Greetings

Walter

Message 2 of 3
(2,148 Views)

Thank you very much, worked perfectly!

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