DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

script or operation to split a date and time channel into two channels

Hi There,

 

I have a channel that contains a range of dates and times.

 

I would like to split that channel into two channels - one with date and one with time.

 

Any suggestions?

0 Kudos
Message 1 of 9
(6,345 Views)

Hi,

if both channels (date and time) have the same lentgh, try something like this:

'_________________________________________________________________

dim length

length = Data.Root.ChannelGroups(1).Channels("Channel").Properties("length").Value


Call Data.Root.ChannelGroups(1).Channels.Add("Channel1",DataTypeFloat64,2)
Call Data.Root.ChannelGroups(1).Channels.Add("Channel2",DataTypeFloat64,3)

Call DataBlCopy("[1]/Channel",1,length/2,"[1]/Channel1",1)
Call DataBlCopy("[1]/Channel",length/2+1,length/2,"[1]/Channel2",1)

'_________________________________________________________________

Channel is the channel with both signals, Channel1 contains first half of "Channel", Channel2 contains second half of "Channel".

 

Hope this helps!

Simyfren

 

0 Kudos
Message 2 of 9
(6,338 Views)

Hi officespace,

 

WHY?   DIAdem works MUCH better with a DateTime channel than with separate Date and Time channels.  If you just want to format the display of Date or Time only, just leave the DateTime channel the way it is and change the format string to what you want for tabular or graph axis formatting changes.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 3 of 9
(6,317 Views)

Brad:

I'm not quite sure what Officespace is trying to do..        But I have a need for the same function.

I have a recorder  ( Thermotron ) that gives you a Time Channel and a Date Channel ( it is a .csv format) . When you try to plot them you can use either or.

I would like to strip the Time data from the "Date" channel and concantenate it with the Date data from the "Time" channel. This would then becon one channel with Data and Time.   I attached the raw data that I am talking about...The Concantenation part is where I'm humg up on.

If you could help, That would be great...

 

Thanks

Spidey

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

Sorry:    Here is the attachment......

 and Sample of the data

 

Comment:              
               
Date Time AIR TEMP AIR TEMP SP TAC PTC Load Temp Channel 4 UUT Front TC
1/20/2015 12:30:05 80.3 79.3 59.4 0 0 62.9
1/20/2015 12:30:11 80.1 79.3 59.5 0 0 63
1/20/2015 12:30:17 80 79.3 59.6 0 0 63
1/20/2015 12:30:23 79.9 79.3 59.7 0 0 63.1
1/20/2015 12:30:29 79.7 79.3 59.7 0 0 63.2
1/20/2015 12:30:35 79.7 79.3 59.8 0 0 63.4
1/20/2015 12:30:41 79.6 79.3 59.9 0 0 63.4
1/20/2015 12:30:47 79.6 79.3 60 0 0 63.5
1/20/2015 12:30:53 79.5 79.3 60 0 0 63.5
1/20/2015 12:30:59 79.5 79.3 60.2 0 0 63.6
1/20/2015 12:31:05 79.6 79.3 60.3 0 0 63.7
1/20/2015 12:31:11 79.6 79.3 60.3 0 0 63.7
1/20/2015 12:31:17 79.6 79.3 60.5 0 0 63.8
1/20/2015 12:31:23 79.7 79.3 60.6 0 0 63.9
1/20/2015 12:31:29 79.7 79.3 60.7 0 0 64
1/20/2015 12:31:35 79.8 79.3 60.8 0 0 64.1
1/20/2015 12:31:41 79.8 79.3 60.9 0 0 64.3
1/20/2015 12:31:47 79.8 79.3 61 0 0 64.4
1/20/2015 12:31:53 79.7 79.3 61.1 0 0 64.4
1/20/2015 12:31:59 79.7 79.3 61.2 0 0 64.5
1/20/2015 12:32:05 79.7 79.3 61.3 0 0 64.6
1/20/2015 12:32:11 79.6 79.3 61.4 0 0 64.7
1/20/2015 12:32:17 79.6 79.3 61.5 0 0 64.8
1/20/2015 12:32:23 79.6 79.3 61.6 0 0 64.8
1/20/2015 12:32:29 79.5 79.3 61.6 0 0 64.8
1/20/2015 12:32:35 79.5 79.3 61.7 0 0 64.8
1/20/2015 12:32:41 79.5 79.3 61.8 0 0 64.9
0 Kudos
Message 5 of 9
(5,575 Views)

Hi Spidy,

 

This is more common.  What DataPlugin are you using to load these **.csv data files into DIAdem?  Typically you would do the merging of the date and time channel inside the DataPlugin that loads the data file.  The worst case scenario is that we write a new DataPlugin from scratch-- you file looks pretty simple.  It would help if you would post an example file as an attachment.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 6 of 9
(5,532 Views)

Hi Brad:

 

Thanks for your response. I created the Plugin (that might be the problem).

The file is from a Thermotron ( environmental chamber) . I couldn't find a way to combine the two channels into one Time and Date Channel.

Attached is the file sample.

 

Thanks as always for your help !!

Download All
0 Kudos
Message 7 of 9
(5,520 Views)

Hi Spidy,

 

I happen to already have a Thermotron_CSV DataPlugin that I created a long time ago.  It seems to work very well on your submitted data file.  You have to use a "ProcessedChannel" to create a DateTime channel out of the 2 existing Date and Time channels, if you go poking through the DataPlugin code to see what works the magic.  It's only about 50 lines of code from top to bottom.

 

Brad Turpin

DIAdem Product Support Engineer

 

0 Kudos
Message 8 of 9
(5,511 Views)

Thanks So  Much  Brad.....You even work on Sunday's!!

 

This forum is always so helpful ! 

 

Spidey

0 Kudos
Message 9 of 9
(5,506 Views)