The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Date Format
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

OndrejM

Australia
Posts

Posted - 04/22/2008 :  02:46:42 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi Guys,

My today's problem is Date format of a column. My data were logged every 3 sec as follows:

2008/02/14 09:17:00
2008/02/14 09:17:03
2008/02/14 09:17:06
2008/02/14 09:17:09
2008/02/14 09:17:12
2008/02/14 09:17:15
2008/02/14 09:17:18
2008/02/14 09:17:21
2008/02/14 09:17:24

but I need to get only seconds for this column, how can I do that? at the beginning will be 0 sec., 3, 6, 9,60, 63, etc., Ive already set up the custom date format (yyyy'/'MM'/'dd' 'HH':'mm':'ss) so Origin knows that this column is DATE,

Many Thanks
Ondrej

greg

USA
1379 Posts

Posted - 04/22/2008 :  4:03:37 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
My understanding of this is that you want a column with elapsed time in seconds. This can be easily done with a Set Column Values.

To use Time Format (00:00, 00:03, etc)
Add new column
Set column format to Time and choose your subformat
Use Set Column Values on this column with
col(A) - col(A)[1]
Where 'A' is the name of your Date column

To use Numeric Format (0, 3, etc.)
Add new column
Set column format to Numeric
Use Set Column Values on this column with
86400 * (col(A) - col(A)[1])
Where 'A' is the name of your Date column

(There are 86400 seconds in a day and Time values represent the fractional part of a day.)


Go to Top of Page

OndrejM

Australia
Posts

Posted - 04/22/2008 :  7:33:07 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Greg.
Ondrej
Go to Top of Page

OndrejM

Australia
Posts

Posted - 04/22/2008 :  7:55:57 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Greg,

I'm trying both approaches but it doesn't seem to work properly,...

I think problem is that my column is Date (yyyy'/'MM'/'dd' 'HH':'mm':'ss)

2008/02/14 09:17:00
2008/02/14 09:17:03
2008/02/14 09:17:06
2008/02/14 09:17:09

when I change Format of the column from Date to Time (HH:mm:ss) I'm
getting something like this

00:57:37
00:57:40
00:57:43
00:57:46
00:57:49
00:57:52
00:57:55
00:57:58
00:58:01

now I can do simple math (col(a)-col(a)[1)) as you suggested but it fail when day change,...

here is an example of graph I want to produce but I want to have seconds on X axis,... I haven't found any option how to do that,...

Many Thanks
Ondrej


Go to Top of Page

easwar

USA
1965 Posts

Posted - 04/22/2008 :  9:54:09 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

when I change Format of the column from Date to Time (HH:mm:ss) I'm
getting something like this



Hi,

Greg was suggesting to leave your original date-formatted column alone and create a new column, such as col b, and set it as
col(b)=col(a)-col(a)[1]
Then you can format col b as Time (which seems to be what you want) and select a format such as DDD:hh:mm:ss and that should work?

If you mean seconds as "number of seconds elapsed, with no consideration of how many minutes, hours or days", then you could user the formula
col(b)=86400*(col(a)-col(a)[1])
and leave col b as numeric or text_numeric

Then you can set B as x and put your y values in col c and plot?

If this does not make sense, can you send your data to tech so we can take a look?

Easwar
OriginLab

Go to Top of Page

OndrejM

Australia
Posts

Posted - 04/22/2008 :  11:46:50 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Easwar

yep, it makes sense, I've just done it,... looks okay now,...

The problem was that I was trying to do it by Lab Talk script, and I found interesing featrue which I've arelady decriebed in Lab Talk Forum,...

____

I've defined custom Date Format: yyyy'/'MM'/'dd' 'HH':'mm':'ss and it works when I change the column format manually,... however, for some reason when I want to do it by LabTalk it doesn't work,...

win -a data12;
wks.col1.format=4; //set formation Date
wks.col1.subformat=20; //use custom 1 display

- this script delete the values in Col1 !? but when manually check the format and subformat it was really changed,...

do you know what can be the cause?

Thanks
Ondrej


Go to Top of Page

greg

USA
1379 Posts

Posted - 04/23/2008 :  2:04:48 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This problem occurs because two properties have to change at once - something the dialog accomplishes easily.

There is a little trick you can do with script to get the conversion to work properly (here demonstrated on column 2 data):

wks.col2.format = 2; // Switch Format to Text first
wks.col2.subformat = 20; // Pre-Set the subformat to CUSTOMFORMAT1
SYSTEM.DATE.CUSTOMFORMAT1$ =yyyy'/'MM'/'dd' 'hh':'mm':'ss;
wks.col2.format = 4; // Now set Format as Date


Go to Top of Page

OndrejM

Australia
Posts

Posted - 04/24/2008 :  02:06:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Greg, it works very well,..
Cheers
Ondrej
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000