Author |
Topic |
|
neutrondude
Brunei
Posts |
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.
|
|
greg
USA
1378 Posts |
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;
|
|
|
|
Topic |
|
|
|