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
 importing data with fixed column limitation
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

leo_C

Brazil
Posts

Posted - 12/07/2007 :  08:39:49 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5
Operating System: xp

Hello again!
For some reason I couldn´t retrieve my password for this forum so I had to register again.

Well, I have some text data with fixed columns so that data is truncated between lines like in the example below. I wish to convert to Origin. Is there a procedure to automatically import, or is there an option to place an script to automatically do this dirty job? I use to import my files just by dragging and dropping them to Origin.
Thanks!

2.61 0.0 295.67001 0.20258 1.17542 1.1872 0.15276 -0.19521
-0.00062 0.0008 0.00549
0.574 0.0 296.23801 0.20277 1.17636 0.96822 0.13412 -0.13448
-0.00154 0.00138 0.008
-1.513 0.0 296.85901 0.20298 1.17744 0.7135 0.11885 -0.06976

Mike Buess

USA
3037 Posts

Posted - 12/07/2007 :  12:57:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Seems to me you want to move even rows up to the end of the previous row...

before:
2.61 0.0 295.67001 0.20258 1.17542 1.1872 0.15276 -0.19521
-0.00062 0.0008 0.00549
0.574 0.0 296.23801 0.20277 1.17636 0.96822 0.13412 -0.13448
-0.00154 0.00138 0.008


after:
2.61 0.0 295.67001 0.20258 1.17542 1.1872 0.15276 -0.19521 -0.00062 0.0008 0.00549
0.574 0.0 296.23801 0.20277 1.17636 0.96822 0.13412 -0.13448 -0.00154 0.00138 0.008


If I'm wrong then please explain. Otherwise you can use the script below. If you use Import ASCII then save it as the Worksheet Script (Tools> Worksheet Script) for your worksheet template and set Run Script Automatically after: Import. If you use a filter save the script under its Advanced filter options.

rr=wks.maxrows; // current number of rows
cc=wks.ncols; // current number of columns
work -a 3; // add 3 columns
for(i=1;i<=rr/2;i++)
{
work -s 1 (i+1) 3 (i+1); // select first 3 columns of next row
menu -e 57634; // execute Edit> Copy
work -s (cc+1) i (cc+3) i; // select last 3 columns of this row
menu -e 57637; // execute Edit> Paste
mark -d col(1) -b (i+1) -e (i+1); // delete next row
};

Mike Buess
Origin WebRing Member
Go to Top of Page

leo_C

Brazil
Posts

Posted - 12/18/2007 :  4:02:39 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks, Mike!

I will try this after I´m back from my vacations :D

I plan to modify this script for a n number of "extra" columns also, maybe it would be useful too

regards


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