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