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 for Programming
 Forum for Origin C
 Creating relative time scale
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

szailer

USA
10 Posts

Posted - 04/30/2007 :  2:59:08 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7, SR4
Operating System: Win XP

I'm a beginner:)
I'm trying to write a code for the following operation:
-I've got a time stamp as X column, format: 11:14:45.71-->hh:mm:ss.##
-I've days of data-in about every seconds
-I'd like to get a relative time scale in seconds

So far I do it manually:
Copy first value of the Time column, create a columnB with this one data, substract this value from column Time. It's fine until it reaches midnight. Since the starting point is 1 day before,my time scale has to be corrected manually-I look for the switch-point, manually copy again that single value to columnB, get the latest good relative time point and add to the calculation.

Could anyone help me to write this code?
Thanks!

Tamas

Mike Buess

USA
3037 Posts

Posted - 05/02/2007 :  1:21:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Tamas,

I'm not sure what you want to accomplish. Show time in seconds but keep track of elapsed days? Assuming time is now in column A the following expression will put time in seconds in column B. Midnight occurs at multiples of 86400, which is the number of seconds in a day.

col(B) = ( col(A) - int(col(A)[1]) ) * 86400;

Mike Buess
Origin WebRing Member
Go to Top of Page

szailer

USA
10 Posts

Posted - 05/02/2007 :  1:51:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

It turned out that Origin is much smarter that I expected:)
I have actually a time column and a date column too.
So I used col(time)[1] col(date)[1] to create my relative time scale.
col(reltime)=col(time)-col(time)[1]+col(date)-col(date)[1]
So thanks for the help.

My next step would be the following:
I have several data sections in a big file. I use now 'Extract data' funcion but I'd be happy to have it in a script.
So I have a column containing the times to start and stop slicing.
Could you please help me to write it?

Tamas Szailer
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 05/02/2007 :  2:26:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Tamas,

I'm not going to guess the details because I seem to have got it totally wrong last time. You have a column with start & stop times. Do you really mean stop times only?

stop1
stop2
stop3
...

Rows 1 through row(stop1) are extracted to wks1.
Rows 1+row(stop1) through row(stop2) are extracted wks2.
Rows 1+row(stop2) through row(stop3) are extracted wks3.
...

Also, last time you said you have separate date and time columns. Which column do your stop times refer to?

Mike Buess
Origin WebRing Member
Go to Top of Page

szailer

USA
10 Posts

Posted - 05/02/2007 :  3:50:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Sorry!

Unfortunately my stop time is not always equals to start time. So lets say I have two columns: one starter, one stopper (and they can be the same as value but 1 row offset).

I do not need row 1 for each file (the header would be nice to maintain), so basically it's just sectioning my worksheet by time.

The time for slicing comes from a different source.

That's the next question-how to get these triggers automatically.

I have two intstruments, two time tables. One tells me the triggers, other one measures chemical composition. So that's way it's tough to get common time scales.

For the trigger:
I have 3 parameters. 3 columns. Every second. When they all go to zero,that's my trigger for stop slicing. But not immediatelly. I have this event for 300 seconds-300 points. I would like to slice at about 150 second-in the middle. So this 300 second is the separator. But it can be more-that's way I would have two separated columns for stops and starts.

Many thanks!

Tamas

Tamas Szailer
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