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
 Simple Import/Data Manipulation/Export Macro
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

caaok

1 Posts

Posted - 05/07/2009 :  2:34:15 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 8.0724 and Service Release 0:
Operating System: Windows Vista

Basically I have a ton of worksheets in ASCII format, named "blah.0001", "blah.0002", etc. Here's what I currently have to do:

1. Import the file "blah.0001" as ASCII. Only columns 1,2,3,7 are relevant for my purposes.
2. Overwrite the data in column 2 with (column 7/column 3). Currently I use the "Set Column Values" feature to set column 2 this way.
3. Select column 1 and the newly overwritten column 2 and export these two columns as ASCII to the file "blah.001" (note the lack of third zero).

Basically I'm normalizing the data in column 7 with the values from column 3. This seems like the sort of thing that would be really easy to macro but I have no idea how. Ideally I'd be able to execute this on a massive scale, since I have hundreds of these files to go through, so perhaps import multiple ASCII and import all the files at once, then execute the macro?

Any tips for me? I have a BASIC knowledge of C from first year at university (I understand functions, if-else statements, loops, variables, etc), but I'm not sure how to get at the proprietary aspects of the origin data, or how to handle the file I/O.

Iris_Bai

China
Posts

Posted - 05/26/2009 :  11:51:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi caaok,

After step 1 above I know you want to use Origin C to import ASCII data with partial columns and step 3 is want to export data from two columns to ASCII data file, right? Please refer to the example in this wiki linking for ASCII import
http://ocwiki.originlab.com/index.php?title=OriginC:ASCII_Import#To_show_how_to_do_partial_import

About export ASCII, we did not support simple Origin C function for customer. Would you mind to use X-Funciton? Hight the columns that want export and run the following in Command Window like running LabTalk.
expASC path:=c:\test\abc.txt select:=1
or in Origin C
LT_execute("expASC path:=c:\\test\\abc.txt select:=1");


But for step 2, could you give more details?

Iris
Go to Top of Page

Sophy

China
Posts

Posted - 06/02/2009 :  05:25:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi caaok,

I guess in step2, you want to divide the data in column7 with that in column3, and assign the result to column2? If this is the case, you can simply type "col(2)=col(7)/col(3)", or use LT_execute("col(2)=col(7)/col(3)") in Origin C.

Notes:In LabTalk, column index is 1-offset.
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