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
 All Forums
 Origin Forum
 Origin Forum
 access wks-name

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
bjornh Posted - 06/13/2001 : 08:34:11 AM
Hi,

maybe somebody can help me find a way to specifically adress all worksheets created when importing ascii-files using the option "When non-numeric...Start new worksheet/column".
I need to loop through the new worksheets in order to move all Y-columns to the first worksheet. I´m currently running 6.1 SR2

Thanks, Bjorn
5   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 06/19/2001 : 09:17:58 AM
It occurred to me that the lengths of the data columns indicate exactly where to find the labels. Try import2.zip... it should be much faster.

Mike Buess
Origin WebRing Member
Mike Buess Posted - 06/17/2001 : 11:47:53 AM
You can download import.zip (3KB), which provides a simple method for importing and labelling data that are formatted as in your example. It contains two worksheet templates (MyData.otw and MyLabels.otw) and a script file (Import.ogs) which should all be copied to your Origin program folder. Import your data with this command:
run.section(Import,Main);
The chosen data file is imported to both worksheet templates. In the MyData worksheet the data sections are separated into separate columns. Text is then extracted from the MyLabels worksheet and assigned to the MyData column labels. (The MyLabels worksheet is deleted afterwards.) The scripts for extracting the labels make the following assumptions about your data file format.
  • Text lines always occur in pairs (Name followed by [unit]).
  • The first data section contains at least two columns.
  • Subsequent data sections contain exactly two columns.
  • There are no missing data values (--) in the first column.
Labels are found by examining the first column of the MyLabels worksheet row-by-row for missing values:
if (col(1)[ii]==0/0) {//then it must be text};
That might take some time if your data files are large. Perhaps someone else can come up with a more efficient method for extracting the text.

Note: I also assumed that the first column in each data section should be an X-column. If that's not the case just delete the following line near the end of Import.ogs:
wo -t ii 4;


I hope this helps,

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 06/17/2001 11:49:12

Edited by - Mike Buess on 06/17/2001 12:30:22
Mike Buess Posted - 06/15/2001 : 08:46:35 AM
If you've managed to put the different data sections into separate columns then you must also have the "When non-numeric is found..." ASCII option set to "Start new worksheet/column". In that case only text at the beginning of the data file is used for column names/labels - subsequent text is discarded. In your example, subsequent text could not have been used for column names anyway because duplicate column names are not allowed.

It sounds like you've accomplished everything you want except for the names and labels. If those are always the same, then the easiest thing to do is to use a worksheet template with columns that are already named and labelled. (Make sure that "Rename columns..." and "Create column labels.." are unchecked in the Other Options for that template.)

If your data file format or labels vary then change the "When non-numeric is found..." setting to "Read as missing data" and make sure that the column display is set for "Text & Numeric". Text fields will then be imported along with the data and you can sort things out later with a LabTalk script. I can't suggest an appropriate script without knowing more about your data.

Finally, Origin Professional gives you much more control over ASCII and binary data import. If you have Origin Pro you should read the File Utilities section of the OriginPro Manual for information.


Mike Buess
Origin WebRing Member
bjornh Posted - 06/14/2001 : 11:36:30 AM
Thanks for Your support Craig,

I found an alternative method by setting the import-option "Import as...." in position "As new columns". By doing this all sections of numeric data gets separate columns in one wks. The only problem is that I seem to loose most of the header info because the header label that I´ve added is overwritten each time the import routine finds the text-rows that begins every new section of numeric data. Do You know of any way to keep all this text, which I need to access in order to rename the new columns?
I´m adding a reduced example of my ascii file:

Time lamsoni_w lamsons_w rl nmot
[s] [-] [-] [%] [Upm]
0.003 0.99561 1.00000 19.5 1160
0.013 0.99414 1.00000 19.5 1160
0.063 0.98999 1.00000 19.5 1160
0.073 0.99121 1.00000 19.5 1160
Time CHAN2
[s] [Lambda]
0.060 1.021
0.214 1.028
0.232 1.028
Time CHAN2
[s] [Lambda]
0.056 1.014
0.074 1.014
0.346 1.035
Time CHAN2
[s] [Lambda]
0.052 1.026
0.070 1.029
0.090 1.032

/Bjorn
CStorey Posted - 06/13/2001 : 11:23:19 AM
What I would do is write a LabTalk script that can run from a button or menu.

Here are the basics:

// To get all worksheet names and copy a column

%Z="";
doc -e W {
%Z=%Z %H; //creates a list of all worksheets
};

I would then select those worksheets you wish to extract data from into a separate list and loop over each copying data to a new worksheet. You might want to look at the following commands:

win -n winType [winName] //Create a wks for

[WksName]!wks.joinMode=0; //Set the wks mode to append new columns

[WksName]!wks.colSel(colNum,n) //Select a column

[ToWks]!wks.join(FromWks) //Copy all columns from 1 wks to another

Hope this helps.

Craig Storey
Origin WeRing Member - http://nav.webring.yahoo.com/hub?ring=originwebring&id=1&hub



Edited by - cstorey on 06/13/2001 11:26:57

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000