03-06-2019 09:17 AM
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?
Solved! Go to Solution.
03-07-2019 12:30 AM
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
03-07-2019 03:28 AM
Thank you very much, worked perfectly!