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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Results log -> text label (Origin 6.1)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Daireann

Canada
Posts

Posted - 12/10/2003 :  1:17:21 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi!

I'm looking for a way to send, with a labtalk script, the text printed in the results log after a linear fit to a text label I created on the graph.

In Origin 6.1, is it possible to redirect the text output of the type command to a user-created visual object, i.e. a text label? Alternatively, if I put the text in a string variable, is there a more permanent way to display it in my text label than putting the variable (e.g. %Z) in the text dialog box and checking the "link to variables $,%" box in the label control? I don't want the text to change each time I re-open the project...

rlewis

Canada
253 Posts

Posted - 12/10/2003 :  3:34:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If you have a text label named "LabelName" then you can place the desired text in %Z and the command "LabelName.text$=%Z" should then do the trick ....
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 12/13/2003 :  10:25:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If I or Daireann were to use rlewis' method, how could we assign the contents of the Results Log to %Z? I'm using Origin 7.5 so an OC solultion would work for me.

Mike Buess
Origin WebRing Member
Go to Top of Page

rlewis

Canada
253 Posts

Posted - 12/13/2003 :  6:31:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
After reading Mike's post, I realized that there is no easy way access the contents of the Results Log through LT or OriginC code (at least none that I'm aware of). Perhaps OriginLab couls conside including such a feature in the next version. However, it is feasible to solve Daireann's original problem by editing the the relevant section of the LR.OGS file to store a copy of the output in %Z and then display it in a text label. The following example seems to do what Daireann wants

[MenuLROutput]
SaveRedirection=type.Redirection(16,3); // SDB 1/7/99 REPORT_TO_OUTPUTLOG
type.BeginResults(); /// RKM 12/10/98 v6.0141 REPORT_TO_OUTPUTLOG
%A=Stat.Data$;
if (layer.x.space==1 && layer.y.space==1)
{
type $regression.performLR;
type $regression.EqnForLR;
%Z=$regression.performLR;
%P=$regression.EqnForLR;
%Z=%Z
%P;
}
else
{
type $regression.LRApparent;
type $regression.LREqnApparent;
type $regression.LRmsgApparent;
%Z=$regression.LRApparent;
%P=$regression.LREqnApparent;
%Z=%Z
%P;
%P=$regression.LRmsgApparent;
%Z=%Z
%P;
}

/* Now check to see if there is error data and if it is in plot */
%A=stat.data$;
%B=errof(%A)$;
if (exist(%B)==1)
{
type $regression.UsingWeight;
%P=type $regression.UsingWeight;
%Z=%Z
%P;
}
type;
type $regression.ShortParaHeader1;
%P=" ";
%Z=%Z
%P;
%P=Parameter Value Error;
%Z=%Z
%P;
separator 4;
%Q="------------------------------------------------------------";
%Z=%Z
%Q;
type "A\t$(Stat.LR.A)\t$(stat.LR.Ase)";
%P="A $(Stat.LR.A) $(stat.LR.Ase)";
%Z=%Z
%P;
type "B\t$(Stat.LR.B)\t$(stat.LR.Bse)";
%P="B $(Stat.LR.B) $(stat.LR.Bse)";
%Z=%Z
%P;
%Z=%Z
%Q;
%P=" ";
%Z=%Z
%P;
separator 4;
type;
%P="R SD N P";
%Z=%Z
%P;
%Z=%Z
%Q;
type $regression.ShortParaHeader2;
separator 4;
if (stat.pValue<0.0001) %A="<0.0001"; else %A=$(stat.pValue);
%P="$(Stat.R) $(Stat.SD) $(stat.npts) %A";
%Z=%Z
%P;
type "$(Stat.R)\t$(Stat.SD)\t$(stat.npts)\t%A";
separator 4;
%Z=%Z
%Q;
type.EndResults();
type.Redirection=SaveRedirection; // restore previous redirection.
delete -v SaveRedirection;
label -n LinearFit NewLabel;
LinearFit.text$=%Z;
return 0;

Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 12/19/2003 :  3:08:28 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Have we decided for certain that there is no way to programmatically access the Results log? I'm interested in saving it to a text file. One can Select All, Copy and even Print the Results log from GUI. LT and/or OC can access all other windows and even the clipboard. Seems like we should be able to do more with the Results log than just hide, show, clear and add to it.

Mike Buess
Origin WebRing Member
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000