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

OndrejMM

Australia
81 Posts

Posted - 07/12/2009 :  9:12:25 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi Guys,
I do have simple problem,… I would need to import a two-column file which contains multiple data. I was using the Import wizard but I cannot make it work,… data have the following format:
// empty row
X AD-S11-data // column short names
// empty row
0 6.31982 //data
0.52 2.72977
1.03 54.2017
// empty row
// empty row
// empty row
X AD-S22-data //column short names (new worksheet)
// empty row
0 5.98143 // data
0.52 -3.74441
// empty row
// empty row
// empty row
X AD-S22-data //column short names (new worksheet)
// empty row
0 5.98143 // data
0.52 -3.74441
0.52 -5.26446
etc.

I would like to put a new set of data to a new worksheet that partially works within the “import wizard” using “non-numeric data in a numeric filed => start new worksheet” but since a number of empty rows is changing everything is shifted,…

do you have any idea how can I make this working? I was thinking that maybe I can first import all the data into a worksheet and then split them? because there is always X,…

cheers, Ondrej

larry_lan

China
Posts

Posted - 07/15/2009 :  04:23:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Ondrej:

You have to import all your data into worksheet first and then split it. For example, run the following script after imported. (Or you can also put the script in the Advance tab of Import Wizard)

range s1 = %(wks.name$)!col(a); // Get source column
range s2 = %(wks.name$)!col(b);
jj=1;
for(ii=1; ii<=$(wks.maxrows); ii++)
{
	// If found "X", new a worksheet to store data
	if(s1[ii]$ == "X")
	{
		newsheet;
		col(a)[L]$ = s1[ii]$; // Set column labels
		col(b)[L]$ = s2[ii]$;
		jj=1;
		ii++;
	};
	range n1 = col(a);
	range n2 = col(b);
	if(s1[ii] != NULL )
	{
		n1[jj] = s1[ii];
		n2[jj] = s2[ii];
		jj++;
	}
}


Hope this helps.

Larry
OriginLab Technical Services

Edited by - larry_lan on 07/15/2009 04:26:56 AM
Go to Top of Page

OndrejMM

Australia
81 Posts

Posted - 07/16/2009 :  10:09:01 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thank you Larry, sure it helps,...
cheers, ondrej
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