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
 Default Time Display
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

elpado6872

2 Posts

Posted - 11/27/2016 :  04:56:00 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi everybody, my name is Francesco, I'm a PhD student in Physics. I immediately apologize if I missed some of the forum steps, like presentation, but I didn't find specific rules.

Anyway I have a question about how to set up OriginPro 2015. My data is saved as .txt file and the column labelled Time contains time stamps saved in the following format HH:mm:ss.###. When I drag and drop my .txt file Origin recognizes that that particular column is Time and it sets the column to a Time format, which is fine. The problem is that the default display is HH:mm which means that every time I need to change it manually to HH:mm:ss.###

Is there any way to change the default time display? It would be very handy for me because my .txt file contains different time columns and every time I need to change all of them manually. Thanks

Francesco

JacquelineHe

287 Posts

Posted - 11/28/2016 :  06:09:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

When you drag and drop a file into Origin, it will use default template and filter to import your file.
So I suggest you can new a filter with import after script to edit the column format.
For example:

wks.col1.format = 3;  // Set the first column format to Time, Time = 3
wks.col1.subformat = 11; // Display Time format HH:mm:ss.###



1. Select " Tools: Import Filters Manager" in the menu.
2. In the "Filter Manager" dialog, choose "ASCII" filter, and click on "Edit" button.
3. In the filter edit dialog, set the "File Name Filter" to "*.txt"
And copy and paste the above labtalk script to the "Labtalk Script after Import" text box.
4 "Save As" the filter in the "Filter" Folder under User File Folder. Close the dialog.



After that, when you import the txt file, the "Select Filter" dialog will pop-up.
You can choose the new filter for importing the file, and the first column will be set to Time format, and display to "HH:mm:ss.###"

Thanks
OriginLab
Jacquline
Go to Top of Page

elpado6872

2 Posts

Posted - 11/28/2016 :  10:23:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much Jacquline! That is really helpful and works great for the first column. What if I have a time column also at the 6th column, or 11th column? Something that is not always constant. Is it possible to include a code that recognizes if a column is time and sets that column to HH:mm:ss.###? Because when I drag and drop Origin already recognizes all the columns that are time columns, but it sets them as HH:mm. Can I change that behaviour with some kinf od if statement? Thank you very much!

Francesco
Go to Top of Page

JacquelineHe

287 Posts

Posted - 11/29/2016 :  04:05:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

About your question, I impove the Labtalk script.
Firstly, get the imported worksheet column number, use the loop script to go through the worksheet, and check if the column format is "Time", change the display to "HH:mm:ss.### "


int ncols = wks.ncols; //get worksheet column number
for(int ii = 1; ii<ncols; ii++)
{
if (wks.col$(ii).format == 3)
{
wks.col$(ii).subformat = 11; 
}
}



Thanks
OriginLab
Jacqueline
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