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
 copy fit result into worksheet

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
RobertWeng Posted - 01/12/2007 : 09:17:27 AM
Origin Version (Select Help-->About Origin): 6.0
Operating System: windows xp home edition SP2

I have 25 worksheets.
In each worksheet there are 9 columns with Y plot designation
and 9 columns with corresponding X plot designation


1) I want to plot 25 times 9 graphs (all the corresponding XY columns)

2) I want to fit linear all of them.

3) I want to save automatically the slopes and errors of linear fit
into a worksheet.

4) I want to plot the slopes and errors on a graph.

How can I do that??

plz. help me..

I've never used computer programming... help me~~!!!
8   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 01/18/2007 : 12:06:28 PM
doc -e W
{
if("%[%H,5]"=="Data") // skip if it's a slopes wks
{
%W=%H; // save wks name
wo -s 0 0 0 0; // select all columns
wo -p 201; // create scatter plots
page.label$=Data from %W; // label the graph
page.title=3;
%A=%H; // save graph name
win -i %W; // minimize data wks
win -t D; // create new wks
%B=Slopes%[%A,>5] ;
win -r %H %B;
// prepare columns
wks.col1.name$=Dataset;
wks.col2.name$=Slope;
wks.AddCol(yErr);
wks.col3.type=3;
page.label$=Linear fits of %A; // label the slopes wks
page.title=3;
win -a %A;
ii=1; // perform linear regression on all dataplots, store slopes
doc -e D
{
if("%[%C,>'_']"!="Line")
{
lr %C; // perform linear regression
%B_Dataset[ii]$=%C; // save dataset name to slopes wks
%B_Slope[ii]=lr.b; // save slope
%B_yErr[ii]=lr.sdb; // save std dev of slope
ii++;
};
};
win -a %B; // restore slopes wks
wo -s 0 0 0 0; // select all columns
wo -p 201; // create scatter plots
win -i %B; // minimize slopes wks
page.label$=Data from %B; // label the graph
page.title=3;
};
};


Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 01/18/2007 12:10:01 PM
RobertWeng Posted - 01/18/2007 : 09:43:55 AM
I noticed the names of the slopes worksheet are all randomly.

Is it possible to link the name of the slopes worksheet with the graph the slopes are taken from ?

For example;

save the 9 slopes of graph1 into the worksheet slopes1
save the 9 slopes of graph2 into the worksheet slopes2

and so on ...

Thank you very very much if this works !!!!
RobertWeng Posted - 01/17/2007 : 05:56:08 AM
I found the problem:

It should have been if("%[%H,5]"=="Data")
insteat of if("%(%H,5)"=="Data")

Now it works perfektly !

Thank´s !!!!!
Mike Buess Posted - 01/16/2007 : 09:18:09 AM
You must have copied something wrong or else you did not notice the change in my post. if("%(%H,5)"=="Data") means if worksheet name starts with Data as you want.

Mike Buess
Origin WebRing Member
RobertWeng Posted - 01/16/2007 : 08:47:42 AM
Now it doesn´t do anything at all...
Mike Buess Posted - 01/16/2007 : 08:27:14 AM
Replace if("%[%H,7]"!="Slopes") with if("%(%H,5)"=="Data").

Mike Buess
Origin WebRing Member
RobertWeng Posted - 01/16/2007 : 07:41:30 AM
Thank you very much Mike!
It works perfect!

What I forgot to mention is that I have some other worksheets open as wel.
This script loops through all of them.
Is there a way that it loops only through the 25 DATA worksheets ?

Thank you very much !!
Mike Buess Posted - 01/12/2007 : 11:58:02 AM
The following script should work. You can run it from the Custom Routine button as described here.


// loop through all worksheets in project
doc -e W
{
if("%[%H,7]"!="Slopes") // skip if it's a slopes wks
{
%W=%H; // save wks name
GetEnumWks Slopes; // create new slopes wks
%A=%H; // save its name
// prepare columns
wks.col1.name$=Dataset;
wks.col2.name$=Slope;
wks.AddCol(yErr);
wks.col3.type=3;
page.label$=Linear fits of %W; // label the slopes wks
page.title=3;
win -a %W; // restore data wks
wo -s 0 0 0 0; // select all columns
wo -p 201; // create scatter plots
win -i %W; // minimize data wks
page.label$=Data from %W; // label the graph
page.title=3;
ii=1; // perform linear regression on all dataplots, store slopes
doc -e D
{
if("%[%C,>'_']"!="Line")
{
lr %C; // perform linear regression
%A_Dataset[ii]$=%C; // save dataset name to slopes wks
%A_Slope[ii]=lr.b; // save slope
%A_yErr[ii]=lr.sdb; // save std dev of slope
ii++;
};
};
win -a %A; // restore slopes wks
wo -s 0 0 0 0; // select all columns
wo -p 201; // create scatter plots
win -i %A; // minimize slopes wks
page.label$=Data from %A (%W); // label the wks
page.title=3;
};
};


Mike Buess
Origin WebRing Member

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