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
 Import scripts

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
neutrondude Posted - 01/29/2010 : 10:49:47 AM
Origin Ver. 7.5 and Service Release (Select Help-->About Origin):
Operating System: XP

Dear all,

I was wondering if I could obtain a way of extracting predetermined info from the header of datafiles I import, e.g. temperature.
As far as I know it cannot be done in the import wizard). I would like to extract e.g. the sample number, time, temp that is written in the gheader of a text and insert it into the coloun info.
Can this be done somehow? Script?
One of my datastructure look like:

Sample NAME, 26.11.2009, 18:16
Diameter[mm] 2.000e+01 Thickness[mm] 1.000e-01 Spacer Capacity[pF] 0.000e+00 Spacer Area[mm^2] 0.000e+00
Fixed value(s) : Temp. [K]=323.157 AC Volt [Vrms]=1.00
Freq. [Hz] Eps' Eps'' Tan(Delta) M Temp [K]
1.0000e+07 2.3932e+00 -3.1477e-02 -1.3153e-02 3.2323e+02
etc..

Could I - in a way analogous to grep/awk in UNIX extract the number after "Temp. [K]=" and paste it into the header of one column with name "B"?

Thank you very much in advance- I would be very grateful for answers.

1   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 01/29/2010 : 5:32:59 PM
The Import Wizard has four different methods of extracting header variables (including writing your own OriginC function), but the more ad-hoc your header information is, the less likely one of the methods will be able to do what you want.

In your case a script at the end of the import filter may be the best approach. The complete Header is stored in the %Z String Register after the import and you can use LabTalk substring notation to get the information you need. To illustrate:

%A = %[%Z,@3]; // Get the third line of the header
%A = %[%A,>'=']; // Get the text after the first '='
%A = %[%A,' ']; // Get the text up to the first space
// Now that we have the temperature in %A, put it in the 'B' column
wks.col$(colnum(B)).label$ = %A;

Of course 8.0 users can make better use of this ..
wks.userparam1$ = Temperature; // Create a header row
wks.userparam1 = 1; // Show it
col(B)[Temperature]$ = %A;

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