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 for Programming
 LabTalk Forum
 Modifying WKSANALY.OGS

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
jonni Posted - 10/22/2003 : 09:34:33 AM
Hi,

Using the correlate function in Origin appends two columns to the worksheet (Lag and Corr). I usually run this from the script window using run.section(WKSANALY,Correlate). The section is included at the end of this mail.

I have a worksheet of type XYYYY... and for many columns the correlation process adds many more, if I wish to (auto)correlate all of them. What I want to do is modify the Correlate section of WKSANALY.OGS to create a new worksheet (with some defining title) with the Lag and Corr columns rather than appending them to the original. The way the section is written it looks as though I need to be careful in the additions/removals I make.

Has anyone done something similar that I can follow as an example?

Many thanks.

jonni


[Correlate]
if (run.section(,CorrSelectionCK)!=0)
return 1;
wks.multiX=1; //Enable Multiple X columns
wks.AddCol(Lag);
wks.col$(wks.ncols).type=4; //Set as X
fft.corr.lagdata$=%(%H,wks.ncols);
wks.AddCol(Corr);
wks.col$(wks.ncols).type=1; //Set as Y
fft.corr.corrdata$=%(%H,wks.ncols);
switch(wks.iscolsel())
{
case 1:
fft.corr.poslag=1;
if (fft.corr(%(%H,wks.c1),%(%H,wks.c1))!=0)
{
doc -uw; //Refresh Worksheet
type -b;
type -b $General.BadCalculation;
}
break;
case 2:
fft.corr.poslag=0;
if (fft.corr(%(%H,wks.c1),%(%H,wks.c1+%(%H,@O,1)))!=0)
{
doc -uw; //Refresh Worksheet
type -b;
type -b $General.BadCalculation;
}
break;
}
set %H -ue;
doc -uw;
return 0;
2   L A T E S T    R E P L I E S    (Newest First)
jonni Posted - 10/22/2003 : 1:21:56 PM
Hi greg,

Thanks for your reply. Your suggestion works perfectly!

Best regards,

jonni
greg Posted - 10/22/2003 : 10:26:54 AM
A slight modification to the code sends the results to a new window:

if (run.section(wksanaly,CorrSelectionCK)!=0) return 1;

%M=%H; // Remember the source worksheet
win -t data origin; // Create a target worksheet

wks.multiX=1; //Enable Multiple X columns
wks.AddCol(Lag);
wks.col$(wks.ncols).type=4; //Set as X
fft.corr.lagdata$=%(%H,wks.ncols);
wks.AddCol(Corr);
wks.col$(wks.ncols).type=1; //Set as Y
fft.corr.corrdata$=%(%H,wks.ncols);

win -a %M; // Activate the source worksheet

switch(wks.iscolsel())
{
case 1:
fft.corr.poslag=1;
if (fft.corr(%(%H,wks.c1),%(%H,wks.c1))!=0)
{
doc -uw; //Refresh Worksheet
type -b;
type -b $General.BadCalculation;
}
break;
case 2:
fft.corr.poslag=0;
if (fft.corr(%(%H,wks.c1),%(%H,wks.c1+%(%H,@O,1)))!=0)
{
doc -uw; //Refresh Worksheet
type -b;
type -b $General.BadCalculation;
}
break;
}
set %H -ue;
doc -uw;



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