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
 GPS string and concatenation
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

hr829

15 Posts

Posted - 11/05/2010 :  10:00:46 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver.8.5 and Service Release SR0:
Operating System:Windows 7
i have a GPS time stamp from multiple data files that can be imported as text (or number) in origin. The GPS file uses the GPGGA format (see for example http://aprs.gids.nl/nmea/#gga)
The string appears like 123519 which means 12:35:19 UTC
I could not find a way for Origin to recognize 123519 as a time format so I decided to parse the string and insert the : manually in order to form a time stamp that Origin would recognize. (I have to do this in EXCEL since I could not find a concatenation function in Origin)
Is there a better or easier way to do this?
The conversion is proving to be extremely time consuming since I have multiple files with UTC time stamps that need to be time-aligned.
Any help would be appreciated.

easwar

USA
1964 Posts

Posted - 11/05/2010 :  11:24:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

You don't have to do the conversion in Excel, you can take care of this in Origin by importing your data using Import Wizard.

Steps pasted below, if you need further help, please send one of your data files to tech support and refer to this forum post. We can then send you back a filter.

Origin does have string concatenation functions, but the method below does not use strings, it just uses math to convert the number to proper time and sets format.

Easwar
OriginLab

Steps:
1> Start Import Wizard and select your file
2> Click Next (making any changes to settings for header and other settings relevant to your data file) and get to the "Data Columns" page
3> Check the "Remove leading zeroes from numbers" check box - this is to ensure your time data with 0 hours etc comes in as numeric and does not become text
4> Right click on the time column header and set designation as X, if you want to treat this as X for plotting
5> Proceed to "Save Filters" page and check the "Save Filter" check box
6> Give some name to your filter and enter data extension wild card etc to auto use this filter with similar files in future
7> Check the "Specify advanced filter options" check box
8> In the next "Advanced Options" page, paste this script in the edit box: (it is assumed here that your 1st column has the time info, change as needed):

//Point to column with time info
range t=1;
// Convert to  time
t = ((int(t/10000) * 3600) + (mod(int(t/100),100) * 60) + mod(t,100)) / 86400;
// Set format to HH: mm: ss
wks.col1.format=3;
wks.col1.subformat=3;

8> Press Finish

Then you can use this filter to import other files, see help file and tutorials on more info about import wizard.

Go to Top of Page

easwar

USA
1964 Posts

Posted - 11/05/2010 :  11:36:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

After posting the above, we realized there is a simpler solution using imp wiz without all that math, so try the following:

-> On Data Columns page, check the remove leading zeroes from numbers
-> Right click on the column of interest, and set format as Date (and also set designation as X if desired)
-> In the Custom Date Format edit box on this page, enter:
HHmmss
and click Apply
-> Go to the Advanced options page as outlined before, and enter just these two lines of script to convert the column to Time format:
wks.col1.format=3;
wks.col1.subformat=3;
-> Press Finish

Easwar
OriginLab

P.S. One correction:
The above process first sets the column as Date, which then adds today's date to it. So that part needs to be subtracted before (or after) converting to time, so please change the script to be as below:

//Subtract today's date that gets added in the process
col(1) -= int(@d);
// Convert column to time format
wks.col1.format=3;
wks.col1.subformat=3;
Go to Top of Page

hr829

15 Posts

Posted - 11/05/2010 :  12:20:01 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much but unfortunately I could not get either of these methods to work. They produce 00:00:00 or an empty column.
(btw there is already a HHmmss format in the drop down menu when you get to the Data Columns dialog so I don't think you need to use the Custom Data Format)

I found a similar workaround:
Import the data and then use Format>Column>Time HHmmss
Then Origin seems to recognize this as time and plots things correctly.
The drawback of this method is that it makes it hard to time align data with another GPS source that unfortunately does have the : delimeter.


btw Note that the number in the gps files I am trying to import is already in HHMMSS format so there is no need to convert it to time.
t = ((int(t/10000) * 3600) + (mod(int(t/100),100) * 60) + mod(t,100)) / 86400;






Go to Top of Page

easwar

USA
1964 Posts

Posted - 11/05/2010 :  12:29:09 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

Yes of course there is HHmmss in the drop-down that I overlooked....

Now, regarding the issue of one file having : and the other not, are they files with same extension? If not same extension, then you could set up two separate import wizard filters and have script to set format accordingly. If same extension (or no way to tell from file name and extension what type it is), then in the script you may check one of the entries to see if it has : and then set the format accordingly using script.

Easwar
OriginLab
Go to Top of Page

hr829

15 Posts

Posted - 11/05/2010 :  12:39:16 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
no unfortunately they are not the same extension or format but I think I can get around the issue if i can concatenate two columns of data. Is there a way to do that?
Go to Top of Page

easwar

USA
1964 Posts

Posted - 11/05/2010 :  12:44:27 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I suggest you send one file of each type to tech support and we can then send you back info, or filters, on the best way to handle these.

Please refer to this post in your e-mail.

Easwar
OriginLab

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