From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Copying Data from One Channel to a new Channel Overwrites Channel Name

Solved!
Go to solution

I am writing a script which will take one data channel which has a repeating test sequence of 90 cycles. I'd like to separate the data into 90 separate channels, one for each test cycle.

 

I've created the new channels and copied the data, but when the data is copied into the new channel it overwrites the channel's name with the original channel name +1.

 

Is there a way of just copying the data, not the name as well?

 

Thanks

 

dim i, j, n

i=1
j=900
n=001

Call DataBlClpCopy("[1]/P3_CL 1 PRESSURE [Bar]",i,j)
Call Data.Root.ChannelGroups(1).Channels.Add("Clutch 1 -" &" " & n,DataTypeFloat64,30)
Call DataBlClpPaste("[1]/Clutch 1 -" &" " & n,1,j)

0 Kudos
Message 1 of 4
(2,601 Views)
Solution
Accepted by DTS_PBO
dim i, j, n

i=1
j=900
n=001

Dim newChnl, newChnlName
newChnlName = "Clutch 1 -" &" " & n
Call DataBlClpCopy("[1]/travel",i,j)
Set newChnl = Data.Root.ChannelGroups(1).Channels.Add(newChnlName,DataTypeFloat64, 30)
Call DataBlClpPaste("[1]/Clutch 1 -" &" " & n,1,j)
newChnl.Name = newChnlName

Make sure your destination index (where you have "30") is good.  I never use this parameter.

Message 2 of 4
(2,565 Views)

Thanks, that worked perfectly!

0 Kudos
Message 3 of 4
(2,523 Views)

See the link below for examples of the DataBlCopy() command.

 

http://www.savvydiademsolutions.com/analysis.php?topic=NI-DIAdem-channel-data-manipulation-commands

 

 

0 Kudos
Message 4 of 4
(2,486 Views)