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
 How to process data upon importing?

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
tantiger Posted - 08/01/2002 : 07:48:02 AM
I have some files to be imported, each of them contains a head information and 3 columns of row data. However, I would like to delete the first column and manipulate the other two columns (add something and divide by some value).

With the help of an old post of CStorey, I have finished part of that function, but the important part cannot be completed, I cannot manipulate the columns.

Could anyone take a look of the following scripts and help me? Thanks a lot.

//***************************************//

%L="E:\Desktop";
win -t wks Origin;
%W=%H;
%W!wks.joinmode=0; // Set %W worksheet to append mode
delete %(%W,2); delete %(%W,1);

FDLOG.DlgName$="Import TA Files";
FDLog.Message$="DSC/DTA files only!;
FDLog.ShowComment=0;
FDLog.path$= %L;
FDLog.numtypes=3;
FDLog.type1$=[TXT files]*.TXT;
FDLog.type2$=[DAT files]*.DAT;
FDLog.type3$=[All files]*.*;
FDLog.defType=1;
FDLog.multiOpen.sort=1; // Sort only Groups selected!

If(FDLog.MultiOpen()!=0/0)
{
Loop(mmm,1,FDLog.MultiOpen.Count)
{ newcol=%W!wks.ncols;
FDLog.Get(A, mmm);
win -t wks origin wks$(mmm);
open -w %A;
%T=%H;
#!type "File #$(mmm) - %A";
%W!wks.join(%T);
delete %(%W,$(newcol+1));
win -c %T;
fnpos=0;
pathlength=%[%A];
For(ijk=pathlength; ijk>0; ijk--)
{
If ("%[%A,ijk:ijk]"=="\")
{
fnpos=ijk; //position of "\"
ijk=-10; //end condition
};
};
%B=%[%A,fnpos+1:pathlength-4];
%A=%[%Z,@7];%A=%[%A,"m"];%A=%[%A,>"e"];
#!Type "Name = %B Size = %A";
%W!wks.col$(newcol+1).type=4;
%W!wks.col$(newcol+1).label$="Temp,K";
%W!wks.col$(newcol+1)+=273.15; // This line does not work
%W!wks.col$(newcol+2).label$="%B";
%W!wks.col$(newcol+2)/=%A; //This line does not work,too
}
}
%W!wks.labels();
del -v mmm;
//****************************************//

Edited by - tantiger on 08/01/2002 07:53:57 AM

Edited by - tantiger on 08/01/2002 07:54:41 AM

Edited by - tantiger on 08/01/2002 08:42:02 AM
4   L A T E S T    R E P L I E S    (Newest First)
tantiger Posted - 08/01/2002 : 9:10:49 PM
Yes, this one is also quite good in fulfilling the task.

Thanks a lot for your help!
Mike Buess Posted - 08/01/2002 : 09:12:01 AM
FYI: Here is a variation on your solution that does not actually bring %W to the top...

win -o %W {col($(newcol+1)+=273.15};

win -o makes the named window active only during the bracketed script.

Mike Buess
Origin WebRing Member
tantiger Posted - 08/01/2002 : 08:46:20 AM
Yes, that works fine.

I just find out an awkward solution, use
win -a %W;
to make sure the datasheet is active
and use
col($(newcol+1)+=273.15; ...

Your method is more applicable.

Thank you very much!
Mike Buess Posted - 08/01/2002 : 08:32:59 AM
I think the wks.col object is used to get/set column properties rather than values. As a first attempt, try making the following changes...

%W!wks.col$(newcol+1)+=273.15; --> %(%W,newcol+1)+=273.15;
%W!wks.col$(newcol+2)/=%A; --> %(%W,newcol+2)/=%A;

I hope that fixes it.

Mike Buess
Origin WebRing Member

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