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
 data import question
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

carat64

USA
Posts

Posted - 11/29/2007 :  02:05:38 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 6.0
Operating System: Windows XP

HI,

I have several ASCII files containing data in the format of two columns (X and Y) with 640 rows per column, however it is actually 64 sets of independent data (10 data points each). I need to plot each one independently so that I can fit it with the nonlinear curve fitting. Therefore, how can I convert the two columns into 64 (x2) columns which are also alternately set as X and Y column types? Is there also an easy way to use a label in a column as the column label in the transformed data set?

thanks!!!

Cara

Mike Buess

USA
3037 Posts

Posted - 11/29/2007 :  10:55:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Cara,

quote:
how can I convert the two columns into 64 (x2) columns which are also alternately set as X and Y column types?
Use the script at bottom of this page.

quote:
Is there also an easy way to use a label in a column as the column label in the transformed data set?
I'm not sure what that means but this script copies the column labels from imported to transformed columns...

specSize = 10; // # rows per set
nSpecs = 64; // # sets
work -d; // duplicate worksheet
work -a 2*(nSpecs-1); // add more columns
set %H -er wks.maxrows; // set their size
%L=wks.col1.label$; // get column 1 label
%M=wks.col2.label$; // get column 2 label
loop(i,1,nSpecs-1) {
rov = 1 + i*specSize; // next set starts here
wks.col$(2*i+1).type = 4; // odd # columns are X
wks.col$(2*i+1).label$ = %L; // set odd column label
wks.col$(2*i+2).label$ = %M; // set even column label
copy -b rov col(1) wcol(2*i+1) -b 1 -e specSize;
copy -b rov col(2) wcol(2*i+2) -b 1 -e specSize;
};
set %H -er specSize; // remove extra rows

Mike Buess
Origin WebRing Member
Go to Top of Page

carat64

USA
Posts

Posted - 11/30/2007 :  12:34:53 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Thanks for your help. When I enter the script in the script window (remove the last semicolon) and hit enter, I get a command error. Same thing if I highlight the data and then hit enter in the script window.

Cara

Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 11/30/2007 :  12:53:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
To execute from the script window select all lines of script and press Enter. The active worksheet must have two columns and 10x64=640 rows. I get no command errors under those conditions.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 11/30/2007 1:07:58 PM
Go to Top of Page

carat64

USA
Posts

Posted - 12/02/2007 :  1:05:28 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Mike!

(I haven'tused Origins in a while (obviously)--thanks for the reminder!)

Cara

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