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
 LabTalk Forum
 import only part of an ascii file?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

andrewdsto

Australia
Posts

Posted - 07/06/2009 :  02:29:41 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 8 sp 4 and Service Release (Select Help-->About Origin):
Operating System: win XP

Hi is there a way of importing, using scripting, only part of an ascii data file.

For example: I have ascii data files with two columns, the first contains time and the second contain pressure data. They may be long files containing millions of data points.

I may only want, say, the first 50,000 points. Can this be done easily within the importing script? Or more inportantly can I import data from the ascii file until say the time column reads 25 ms and then stop importing, rather than have to import a full seconds worth of data and then clip the record after it has loaded.

It would simply save time by not loading unwanted data in the first place. I understand this would mean actively monitoring data as it is loaded.

just wondering if and how it can be done?

thanks Andrew

larry_lan

China
Posts

Posted - 07/06/2009 :  04:26:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Andrew:

You can write something like
impasc	fname:="C:\Program Files\OriginLab\Origin8\Samples\Import and Export\ASCII Simple.dat"
		options.partimp.partial:=1
		options.partimp.lastrow:=10

where options.partimp.partial:=1 asks Origin to use partial import, and options.partimp.lastrow:=10 specifies the number of rows to be imported. More information, please read the impASC function of LabTalk help.

Regards to the second requirtment, what a pity that the Origin import wizard doesn't support "where" clause, so I am afraid you have to import all the data and extract what you want.

Thanks
Larry
Go to Top of Page

andrewdsto

Australia
Posts

Posted - 08/11/2009 :  9:06:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for your help Larry

cheers Andrew
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